Django
The Python web framework with batteries included
Created
2005 by Adrian Holovaty & Simon Willison
Language
Python
Pattern
MTV (Model-Template-View)
Database
ORM → PostgreSQL, MySQL, SQLite
Admin
Auto-generated from models
Security
CSRF, XSS, SQL injection, clickjacking
Used by
Instagram, Pinterest, Mozilla
Best for
Content sites, CMS, APIs
What is Django?
Django is a high-level Python web framework that follows the "batteries included" philosophy. It gives you an ORM, admin interface, authentication, URL routing, template engine, form handling, and more — all built in.
Why Django?
Django lets you build production-ready web applications quickly. Its auto-generated admin panel alone saves weeks of work. The ORM means you write Python instead of SQL, and Django handles security by default.
| Feature | Django | Flask | FastAPI |
|---|---|---|---|
| Type | Full framework | Micro framework | API framework |
| Admin | ✅ Built-in | ❌ | ❌ |
| ORM | ✅ Built-in | Optional | Optional |
| Auth | ✅ Built-in | Extension | Build your own |
| Template engine | ✅ Jinja2 | ✅ Jinja2 | ❌ |
| Best for | Content sites, CMS | Microservices | High-performance APIs |
What you'll learn
| Chapter | What you'll know |
|---|---|
| Setup | Create project, apps, run server |
| Models | Database design with ORM |
| Views | URL routing, function/class views |
| Templates | HTML rendering, template inheritance |
| Forms | User input, validation, ModelForm |
Start with setup to create your first Django project.