What Django Does
- ORM — define models in Python, auto-generate SQL
- Admin — auto-generated CRUD admin panel
- Auth — users, groups, permissions, sessions, CSRF
- Migrations — schema migrations from model changes
- URL routing — regex and path-based URL dispatcher
- Templates — Django template language (DTL) or Jinja2
- Forms — validation, rendering, model forms
- Middleware — request/response processing pipeline
- Caching — Redis, Memcached, file, DB backends
- Security — XSS, CSRF, SQL injection, clickjacking protections
- Django REST Framework — add-on for building APIs
Architecture
MVT (Model-View-Template): Model is the ORM layer, View handles logic and returns responses, Template renders HTML. WSGI/ASGI compatible — deploy behind Gunicorn, uvicorn, or Daphne. Settings-based configuration via settings.py.
Self-Hosting
# Production
pip install gunicorn
gunicorn mysite.wsgi:application --bind 0.0.0.0:8000 --workers 4
# Docker
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["gunicorn", "mysite.wsgi", "--bind", "0.0.0.0:8000"]Key Features
- Batteries-included (ORM, admin, auth, migrations)
- Auto-generated admin panel
- Django REST Framework for APIs
- ASGI support (async views)
- Comprehensive security defaults
- Mature ecosystem (10,000+ packages)
- Excellent documentation
- Huge community
Comparison
| Framework | Language | Philosophy | Best For |
|---|---|---|---|
| Django | Python | Batteries-included | Full apps |
| FastAPI | Python | Async + types | APIs |
| Flask | Python | Micro | Small APIs |
| Rails | Ruby | Convention > config | Full apps |
| Laravel | PHP | Elegant syntax | Full apps |
| Spring Boot | Java | Enterprise | Enterprise |
FAQ
Q: Django vs FastAPI? A: Django is a full-stack framework (ORM, admin, auth all included), suitable for traditional web apps + APIs; FastAPI focuses on high-performance async APIs, suitable for pure API backends and microservices.
Q: Does Django support async? A: Yes. Django 4.1+ supports async views, middleware, and (partial) ORM. Full async ORM is still in progress.
Q: Can admin be used in production? A: Yes for internal management. For user-facing dashboards, customize Django admin or use themes like Django Unfold or Grappelli.
Sources
- Docs: https://docs.djangoproject.com
- GitHub: https://github.com/django/django
- License: BSD 3-Clause