---
django: 6.1.3 (f16e25dcb9fe55734ba4ea2b00ac34405b7df74a)
contents: introduction, startup, handlers, routing, security, models, querysets, sql, database, presentation, auth, services, tooling, leaks
---

# Django Internals

How Django works from the inside: the hidden machinery underneath the framework's promises, verified against Django 6.1.3 and measured on one running application.

Django's official documentation explains how to use the framework better than almost any project in software. This book is about the other side: what actually runs when you declare a model, chain a queryset, stack middleware, or render a template. Every part of Django hands application code a clean Pythonic promise — a model is a class, a queryset is a list, a request is a function call, a migration is a diff — and pays for it with metaclasses, query compilers, descriptor caches, and transaction savepoints.

Each chapter takes one promise apart in four moves: what application code is allowed to believe, the real machinery underneath, what it costs in calls and SQL on the book's running newsroom project, and where the abstraction leaks. Every Django symbol is checked by syntax tree against the pinned release, every mechanism links directly to its exact lines in the right margin, and every call trace and SQL statement comes from running Django itself.
