Django From Zero
Learn the batteries-included Python web framework: the project/app structure and MTV pattern, URLs and views, the ORM and migrations, the famous auto-admin, templates, forms and CSRF, the ORM in depth (and the N+1 trap), the built-in auth system, class-based views and Django REST Framework, testing, and production. The framework that ships with everything, explained.
- What Django Is & Your First Project Django is the batteries-included Python web framework: ORM, migrations, admin, auth, and templates in one box. Meet the MTV pattern, the project-vs-app split, and manage.py, then scaffold a blog.
- URLs & Views How a Django request becomes a response: the URLconf that maps URLs to views, function views that take an HttpRequest and return an HttpResponse, captured URL parameters, the request/response objects, and named URLs.
- Models & the ORM Define your data as Python classes, let migrations build the tables, and query the database in Python instead of SQL — Django's built-in ORM, the makemigrations/migrate loop, and the blog's Post and Comment models.
- The Django Admin Django reads your models and generates a complete web back-office — list, search, filter, create, edit, delete — for free. Register your models, customize with ModelAdmin and inlines, and know its limits.
- Templates & the MTV Pattern How Django turns data into HTML: where templates fit in MTV, the template language, the context dict, template inheritance for shared layout, and the auto-escaping that quietly blocks XSS.
- Forms & Validation How data flows back into your app: a Form class declares fields, ModelForm builds one from a model, the GET/POST view pattern handles it, validation cleans it, and csrf_token keeps it safe.
- The ORM, Deeper QuerySets are lazy and chainable, field lookups and Q/F give you real query power, and the N+1 trap quietly fires a query per row — until select_related and prefetch_related collapse it.
- Users, Auth & Sessions Django's batteries-included auth: the built-in User model and request.user, login/logout views, protecting views with login_required and permissions, and the session machinery that keeps a user logged in.
- Class-Based Views & Django REST Framework Views as classes with one method per HTTP verb, Django's ready-made generic views for standard CRUD, and Django REST Framework for building JSON APIs on top of the ORM you already have.
- Testing & Project Structure Test Django for real — the TestCase test runner with its throwaway database, the in-process test Client for views, fixtures and setUpTestData, plus how to structure apps and keep settings (and secrets) sane.
- Production & Where to Go Next You can build a database-backed, admin-managed, authenticated Django app. Now deploy it with gunicorn behind nginx, serve static files for real, run the security checklist, and pick your next build.