What Is Django? The 'Batteries Included' Python Framework
Django is a Python web framework that includes almost everything a website needs: an ORM, migrations, an admin panel, authentication, forms and security protections. What it is, how a Django project is structured, its famous admin, when it's the right choice, and how it compares with Flask and FastAPI.
Django is a Python framework for building websites and web apps. Its motto is "the web framework for perfectionists with deadlines", and its approach is batteries included: most of what a typical site needs comes built in, designed to work together.
Instagram, Pinterest and many newsrooms and government sites have been built on it. (What is Python?, What is a framework?)
What's included
- An ORM — define your data as Python classes; Django handles the SQL. (What is an ORM?)
- Migrations — schema changes generated from your models. (Database migrations explained)
- The admin — a complete back-office interface to view and edit your data, generated automatically.
- Authentication — users, passwords (securely hashed), sessions, permissions, groups.
- Forms — with validation and error messages.
- Templates — server-rendered HTML pages.
- Security protections on by default — CSRF tokens, SQL injection protection, XSS escaping in templates, clickjacking headers. (CSRF explained)
How a Django project is organised
pip install django
django-admin startproject mysite
cd mysite
python manage.py startapp shop
A project (site-wide settings) contains apps (features). Each app has:
models.py— your dataviews.py— functions or classes that handle requestsurls.py— which URL goes to which viewtemplates/— HTMLadmin.py— what appears in the admin
A model:
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=200)
price = models.DecimalField(max_digits=10, decimal_places=2)
in_stock = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
Then:
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
Register Product in admin.py and you can add, edit and search products at /admin — without writing any UI.
The admin is a superpower
For internal tools, content management and early-stage products, the admin can replace weeks of building dashboards. Many startups run operations from the Django admin for years.
APIs with Django
For a React or mobile front-end, add Django REST Framework (DRF) or Django Ninja to build JSON APIs on the same models and auth. (What is an API?)
When Django is a good fit
- Database-backed sites with users, permissions and content
- You want an admin panel for free
- You want conventions and structure decided for you
- Projects that will grow, with a team
When something else fits better
- A small API or microservice — FastAPI or Flask are lighter. (What is FastAPI?)
- Highly interactive front-ends — Django still works as the back-end, with React in front.
- You prefer JavaScript everywhere — Next.js or Express.
Things beginners trip over
DEBUG = Truein production — exposes code and settings. Always off in production.- Static files don't serve themselves in production — use
collectstaticand WhiteNoise or your web server. ALLOWED_HOSTSmust include your domain, or every request returns 400.- SQLite in production — fine for small sites, but most move to Postgres. (Is SQLite good enough for production?)
All covered in How to deploy a Django app.
EasySpawn runs your Django app behind HTTPS with Gunicorn and PostgreSQL on your own server, with daily backups and Claude Code ready to write models, views and migrations. See how it works or join the waitlist.
Related: How to Deploy a Django App · Flask vs Django vs FastAPI · What Is FastAPI? · What Is an ORM?
Keep reading
What Is SaaS? Software as a Service Explained for Beginners
SaaS (software as a service) is software you use in a browser and pay for by subscription — Gmail, Slack, Notion, Shopify. What makes something SaaS, how SaaS businesses make money, the metrics that matter (MRR, churn, CAC), and what you need to build one.
What Is FastAPI? Python's Modern API Framework, Explained
FastAPI is a Python framework for building APIs that uses type hints for validation and generates interactive documentation automatically. What it is, a minimal example, Pydantic models, async support, automatic docs, how it compares with Flask and Django, and why it's popular for AI backends.