Django
Build database-backed web apps with Django 6.1: requests and URLs, the ORM, forms, auth, the admin, APIs, async work, testing, security and deployment.
35 lessons: 30 free with Pro answers and 5 with a free core.
Examples run with Python 3.14.8 and Django 6.1.2.
Who it is for
Python developers building database-backed web apps. Assumes the Python track's basics (functions, classes, exceptions, virtual environments) and basic HTML; SQL knowledge helps from the ORM-in-depth module onwards.
What you will be able to do
- Trace a request through Django's handler, middleware, URLconf and views, and set up a project the way teams do
- Route URLs to views, render templates with partials, and serve static files
- Model data with the ORM, write and read migrations, and query relationships without N+1 queries
- Keep data correct under concurrency with transactions, constraints and PostgreSQL features
- Validate input with forms and ModelForms, and accept file uploads safely
- Authenticate users, design a custom user model, and enforce permissions down to single objects
- Customise and harden the Django admin, and build pages with class-based views
- Build REST and typed APIs with Django REST framework and Django Ninja, and interactive pages with htmx
- Test, secure, cache, deploy and upgrade Django apps, from the system checks to production servers
Before this track
Revise and practise
- Practice: every exercise and quiz (48 exercises, 35 quizzes)
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “6 of 15 min free” means 6 minutes of the lesson are free.
What a pass opens in this track
13 in-depth parts and 75 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Django foundations
What Django is for, how a request flows through it, which version to use, and a first project set up the way professional teams do it.
- How Django handles a request Free lesson, Pro answers: 20 minutes
- Set up a Django 6.1 project Free lesson, Pro answers: 20 minutes
- Module 2
URLs, views, templates and static files
Routing with path() and converters, writing views that return the right responses, the template language, template partials and static files.
- URL routing with path() and converters Free lesson, Pro answers: 20 minutes
- Views, requests and responses Free lesson, Pro answers: 15 minutes
- Templates: variables, tags, filters and inheritance Free lesson, Pro answers: 20 minutes
- Template partials and custom template tags Free lesson, Pro answers: 15 minutes
- Static files in development and production Free lesson, Pro answers: 15 minutes
- Module 3
Models and the ORM
Designing models, creating and reading migrations, querying with QuerySets and modelling relationships, including the database-level on_delete options added in 6.1.
- Django models: fields, null, blank and choices Free lesson, Pro answers: 30 minutes
- Migrations: makemigrations, migrate and sqlmigrate Free lesson, Pro answers: 20 minutes
- Django QuerySets: create, read, update, delete Free lesson, Pro answers: 20 minutes
- Relationships: ForeignKey, ManyToMany and OneToOne Free lesson, Pro answers: 25 minutes
- Module 4
The ORM in depth: performance, integrity and PostgreSQL
Aggregation and expressions, N+1 queries and 6.1 fetch modes, transactions under concurrency, constraints and composite keys, raw SQL, PostgreSQL features and zero-downtime migrations.
- Aggregation, annotations and expressions Free lesson, Pro answers: 25 minutes
- N+1 queries, prefetching and 6.1 fetch modes Free lesson, Pro answers: 20 minutes
- Transactions, locking and race conditions Free lesson, Pro answers: 25 minutes
- Constraints, indexes and composite primary keys Free lesson, Pro answers: 20 minutes
- Custom managers, raw SQL and EXPLAIN Free lesson, Pro answers: 25 minutes
- PostgreSQL features in Django Free lesson, Pro answers: 20 minutes
- Data migrations and zero-downtime schema changes Free lesson, Pro answers: 20 minutes
- Module 5
Forms, validation and file uploads
Forms and the request cycle, validation in the right layer, ModelForms and formsets without mass assignment, and file uploads that don't trust the client.
- Forms: fields, widgets and the request cycle Free lesson, Pro answers: 20 minutes
- Validation: validators, clean() and model rules Free lesson, Pro answers: 15 minutes
- ModelForms, formsets and inline formsets Free lesson, Pro answers: 20 minutes
- File uploads and storage, done safely Free lesson, Pro answers: 15 minutes
- Module 6
Authentication and authorization
Login, logout and password reset, a custom user model with phone or email login, permissions and object-level access, and account security from hashing to MFA.
- Login, logout and password reset Free lesson, Pro answers: 20 minutes
- A custom user model from day one Free lesson, Pro answers: 15 minutes
- Permissions, groups and object-level access Free lesson, Pro answers: 15 minutes
- Password hashing, lockouts, MFA and social login Free lesson, Pro answers: 20 minutes
- Module 8
Class-based views
How class-based views and mixins work, and the generic views and pagination that cover most CRUD pages.
- Class-based views and mixins Free lesson, Pro answers: 15 minutes
- Generic views and pagination Free core, Pro depth: 6 of 15 minutes free
- Module 11
APIs and modern front ends
REST APIs with Django REST framework, API authentication, webhooks and OpenAPI, typed APIs with Django Ninja, and interactive server-rendered pages with htmx.
- REST APIs with Django REST framework Free lesson, Pro answers: 15 minutes
- API auth, permissions, webhooks and OpenAPI Free core, Pro depth: 7 of 20 minutes free
- Typed APIs with Django Ninja Free core, Pro depth: 7 of 20 minutes free
- Module 12
Testing Django applications
Django's test framework, pytest-django with factories and coverage, browser tests with Playwright, and CI gates that catch missing migrations and unsafe settings.
- Testing with Django's test framework Free lesson, Pro answers: 20 minutes
- pytest-django, factories and coverage Free core, Pro depth: 7 of 20 minutes free
- Module 14
Performance and caching
Caching views, fragments and computations with Redis or the database, HTTP caching, and finding and fixing slow pages with measurements.
- Caching: per-view, fragments, low-level and HTTP Free lesson, Pro answers: 15 minutes
- Django performance: profiling and optimising Free core, Pro depth: 6 of 20 minutes free
Related tools
Official documentation
- Django 6.1 documentation (Django Software Foundation)
- Download Django: supported versions (Django Software Foundation)
- Django 6.1 release notes (Django Software Foundation)
- DEP 0020: Annual Release Cycle (Django Software Foundation (GitHub))