Have you wondered the steps a users request goes through before being responded to by Django? The answer lies in reading
django.core.handlers.wsgi. Here is a diagram explaining what happens. (Click to enlarge.)
The steps are. (With Apache/Mod_wsgi, similar steps for other setup.)
- User’s request comes to Apache etc.
- Apache sends request to
- A list of request and response middleware callables is created.
- Request middleware is applied. If it sends a response, it is returned to the user.
urlresolvers.resolvefinds the view funcion to use.
- View middleware is applied. If response comes, it is sent back to the user.
- View function is called. It talks to models to do business logic, and renders the templates.
- The response middleware is applied, and response is sent back to the users.
This misses a lot of important steps (Exception middleware, request_context populating, …) but is a basic high level overview.
Thank you for reading the Agiliq blog. This article was written by shabda on Jun 25, 2009 in django .
You can subscribe ⚛ to our blog.
We love building amazing apps for web and mobile for our clients. If you are looking for development help, contact us today ✉.
Would you like to download 10+ free Django and Python books? Get them here