Django Tutorial
A complete Django web framework path from beginner to pro - build real apps with models, views, templates, auth, and deployment. Python web development, taught step by step.
Curriculum
Work through each section in order. Every lesson ends with practice and key points so the idea sticks.
Getting Started
- 1What is Django?
Learn what Django is, what it includes, and why it is a popular framework for building Python web applications.
8 min - 2Django vs Other Python Web Options
Compare Django with Flask, FastAPI, and smaller Python web tools so you know when Django is a good choice.
9 min - 3Install Django & Create a Project
Install Django 5.x in a virtual environment and create your first project with django-admin startproject.
12 min - 4Project Structure Explained
Understand the files created by django-admin startproject and where your Django code belongs.
10 min - 5runserver, Settings & Apps
Run the development server, register apps, and understand the settings that make Django project pieces work together.
11 min
Core Ideas
- 6MTV Architecture (Model-Template-View)
Learn Django MTV architecture and how models, templates, and views work together to create pages.
10 min - 7URLs & Routing
Map browser paths to Django views using project URL files, app URL files, path converters, and named routes.
11 min - 8Function-Based Views
Write beginner-friendly Django views with Python functions, HttpResponse, render, request data, and context dictionaries.
10 min
Templates
- 9Templates Basics
Create Django HTML templates, pass data from views, display variables, and loop over lists.
10 min - 10Template Tags & Filters
Use common Django template tags and filters to display lists, conditions, URLs, dates, defaults, and formatted values.
11 min - 11Template Inheritance
Create a base template and extend it so pages can share layout, navigation, styles, and reusable blocks.
10 min - 12Static Files (CSS/JS/Images)
Add CSS, JavaScript, and images to Django pages using static files, app static folders, and the static template tag.
10 min
Models & Database
- 13Models & the ORM Intro
Define Django models and understand how the ORM maps Python classes to database tables.
12 min - 14Migrations
Use makemigrations and migrate to turn Django model changes into database table changes safely.
10 min - 15Django Admin
Use Django admin to manage database records and customize how models appear in the built-in admin site.
11 min - 16QuerySet Basics (CRUD)
Use Django QuerySets to create, read, update, and delete database records with Python.
12 min - 17Model Relationships (FK, M2M, O2O)
Connect Django models with ForeignKey, ManyToManyField, and OneToOneField relationships.
13 min
Forms
- 18Forms Basics
Build Django forms, display them in templates, handle GET and POST requests, and read cleaned data.
12 min - 19ModelForms
Use ModelForm to create and edit model objects with less repeated form code.
11 min - 20Form Validation
Validate Django form fields with built-in validators, custom clean methods, and user-friendly error messages.
12 min
Request & Response
- 21Messages Framework
Show one-time success, error, warning, and info messages after form submissions and redirects.
9 min - 22Redirects & HttpResponse
Return simple responses, redirect users after actions, and choose the right response type for beginner Django views.
9 min - 23Custom 404/500 & Raising 404
Raise 404 errors, use get_object_or_404, and create custom 404 and 500 error templates.
10 min
Building Pages
Views Deep Dive
- 26Class-Based Views Intro
Understand Django class-based views and rewrite common function views as reusable view classes.
11 min - 27Generic List/Detail/Create/Update/Delete Views
Use Django generic views to build common model pages with less repetitive code.
14 min - 28Mixins & Reusable View Logic
Share authentication, filtering, ownership, and context behavior across Django class-based views.
12 min
Auth & Permissions
- 29Users & Authentication
Use Django's built-in user system to check logged-in users and protect practical views.
13 min - 30Login, Logout & Signup Flows
Build practical login, logout, and signup pages using Django auth views and forms.
15 min - 31Permissions & User Passes Test
Protect views with permissions, groups, user_passes_test, and class-based auth mixins.
13 min - 32Password Reset Flow
Wire Django's built-in password reset views with email settings and templates.
14 min - 33Sessions & Cookies
Store per-browser state safely with Django sessions and understand how cookies fit in.
12 min
ORM Power
- 34Advanced QuerySets & Lookups
Filter, combine, slice, and inspect QuerySets using Django ORM lookups and Q objects.
14 min - 35annotate, aggregate & F()
Calculate totals, counts, and database-side expressions with Django ORM aggregation tools.
14 min - 36select_related & prefetch_related
Avoid N+1 queries by loading related data efficiently with select_related and prefetch_related.
13 min - 37Custom Managers & QuerySets
Move reusable ORM filters and domain-specific query methods into managers and QuerySets.
13 min
Files & Media
App Internals
- 39Signals (Practical Use)
Use Django signals carefully for side effects such as creating profiles and reacting to saves.
12 min - 40Middleware Basics
Understand Django middleware and write small request/response hooks for cross-cutting behavior.
12 min - 41Context Processors
Add shared template variables with context processors while keeping global context lean.
10 min
UX Patterns
- 42Pagination
Split long QuerySets into pages with Django Paginator and generic view pagination.
12 min - 43Search & Filtering
Build beginner-friendly search and filter pages with GET parameters and QuerySets.
13 min - 44Flash Messages & UX Feedback
Show one-time success, error, warning, and info messages after redirects.
10 min
Talking Outward
APIs
- 46Django REST Framework Intro
Create your first JSON API with Django REST Framework and understand API basics.
15 min - 47Serializers & ViewSets
Use DRF serializers and viewsets to turn Django models into practical CRUD API endpoints.
16 min - 48API Authentication Basics
Protect DRF endpoints with session authentication, token authentication concepts, and permissions.
14 min
Quality & Safety
- 49Testing Views, Models & Forms
Use Django tests to protect models, forms, views, permissions, redirects, and templates before bugs reach users.
18 min - 50Django Security Essentials
Configure production security settings, protect secrets, avoid unsafe query patterns, and use Django security checks.
17 min - 51CSRF, XSS & Clickjacking in Practice
Understand the browser attacks Django helps prevent and how to keep those protections working in real apps.
16 min
Shipping
- 52Deploying Django (Gunicorn, WhiteNoise, Env Vars)
Prepare Django for production with Gunicorn, WhiteNoise, environment variables, static collection, and deployment checks.
20 min - 53PostgreSQL in Production
Configure Django for PostgreSQL, use migrations carefully, understand indexes, and operate production databases safely.
18 min - 54Static/Media in Production
Understand the difference between static and media files, collect assets, serve uploads, and avoid common production file mistakes.
16 min
Performance
- 55Caching Strategies
Use Django caching at the right layer: per-view, fragment, low-level, database query, and HTTP cache headers.
18 min - 56Async Views & When They Help
Learn what async Django views can and cannot improve, how to call async services, and how to avoid blocking the event loop.
16 min - 57Background Tasks (Celery-style Intro)
Move slow work out of requests with a Celery-style task queue mental model, task definitions, retries, and status tracking.
18 min
Pro Architecture
Capstone Projects
- 60Mini Project: Blog Platform
Build a production-shaped blog with posts, slugs, comments, moderation, tests, templates, and clean URL structure.
20 min - 61Mini Project: Mini Store / Catalog
Build a simple product catalog with categories, product detail pages, admin editing, query optimization, and a contact form.
20 min - 62Mini Project: SaaS Dashboard Shell
Build an authenticated SaaS dashboard shell with organizations, membership, protected views, settings, and tests.
20 min
Polish & Next Steps
- 63Common Django Mistakes (and Fixes)
Recognize frequent Django mistakes in settings, queries, templates, forms, security, migrations, and project organization.
17 min - 64Django Ecosystem (DRF, Admin, Packages)
Know the major tools around Django, when to reach for them, and how to evaluate packages responsibly.
15 min - 65What to Learn After Django
Choose a learning path after Django: APIs, databases, deployment, security, performance, frontend integration, and professional habits.
14 min