A guided tour of everything that happens between someone clicking a link and your view function running. No traps, no gotchas, just how it actually works.
Most articles about Django are about what goes wrong. This one isn't. This is a tour.
Every time someone loads a page in your Django app, a small, elegant machine springs into motion. It unwraps the request, threads it through a stack of layers, finds the right view, runs your code, and packages the answer back up, usually in well under a tenth of a second.
Most of us write views for years without ever watching that machine run. We know our view function gets called with a request object, and we know we return a response, and the space between is a comfortable fog.
Let's clear the fog. We're going to follow a single request from the instant it leaves a browser to the instant the response arrives back, and at each stop I'll show you what Django is actually doing and why.
By the end, request and response won't be magic.…