Django

Django 7,143 is Python's most complete web framework. It is "batteries included": an object-relational mapper (ORM) with migrations, an automatic admin interface, authentication, forms, templates and protection against CSRF and SQL injection all ship in the box. Django 6.1, released on August 5, 2026, supports Python 3.12 to 3.14; Django 5.2 is the long-term support release, maintained until April 2028.

Creating a Django project in a virtual environmentShell
python3 -m venv .venv
source .venv/bin/activate                 # Windows: .venv\Scripts\activate
pip install django
django-admin startproject mysite .
python manage.py startapp hello
python manage.py migrate                  # creates the SQLite database and auth tables
python manage.py runserver

A virtual environment keeps each project's packages separate, which avoids the system-wide pip3 install that Ubuntu 24.04 225 now refuses. Next, add a view that returns JSON and route /api/ to it:

hello/views.py and mysite/urls.py: a JSON endpoint with a URL parameterPython
# hello/views.py
from django.http import JsonResponse
from django.urls import path
def greet(request, name):
    return JsonResponse({"message": f"Hello, {name}!", "method": request.method})
urlpatterns = [path("hello/<str:name>/", greet)]
# mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [path("admin/", admin.site.urls), path("api/", include("hello.views"))]
Output
$ python manage.py runserver
Django version 6.1.1, using settings 'mysite.settings'
Starting WSGI development server at http://127.0.0.1:8000/
$ curl http://127.0.0.1:8000/api/hello/Ada/
{"message": "Hello, Ada!", "method": "GET"}

Run python manage.py createsuperuser to log in at /admin/. To test from a phone on your network, run python manage.py runserver 0.0.0.0:8000 and add your computer's IP address (from hostname -I or ipconfig) to ALLOWED_HOSTS in mysite/settings.py, for example ALLOWED_HOSTS = ['192.168.0.22']; Django rejects any other Host header.

Django suits database-driven sites with many models, admin back offices and content platforms. For small APIs, many Python developers pick the lighter FastAPI 36,700 (14.8% in the Stack Overflow survey 2025) or Flask 15,439 (14.4%), both ahead of Django's 12.6%.