Part IV · In practice
Chapter 13: Where Django leaks
The promiseEach layer is independent.
The machineryThe full measured latency and query ladder of a single endpoint, the failure modes that cross layer boundaries in production, and the sharp Django 6.x shifts that trip up older mental models.
Every earlier chapter opened one layer in isolation. Real production outages almost never stay inside one layer: a lazy QuerySet passed into a cached template fires queries during rendering, a synchronous middleware sitting in front of an async view bounces every request onto a thread pool, and a database connection held open across an external HTTP call exhausts the pool while CPU sits idle.
The cost ladder of one request
When a view returns a rendered page from our newsroom application, time does not spread evenly across Python code. URL resolution and middleware dispatch take microseconds; a single unplanned foreign-key lookup inside a template loop can outweigh the rest of the view combined.