Django Request Response processing

by shabda on June 24, 2009

Have you wondered the steps a users request goes through before being responded to by Django? The answer lies in reading django.core.handlers.base and 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.)

  1. User’s request comes to Apache etc.
  2. Apache sends request to django.core.handlers.wsgi via mod_wsgi.
  3. A list of request and response middleware callables is created.
  4. Request middleware is applied. If it sends a response, it is returned to the user.
  5. urlresolvers.resolve finds the view funcion to use.
  6. View middleware is applied. If response comes, it is sent back to the user.
  7. View function is called. It talks to models to do business logic, and renders the templates.
  8. 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.

Resources


Do you twitter? Do you Github? Find us there.

Related posts:

  1. A response to Dropping Django
  2. Django quiz
  3. Using subdomains with Django

1 Comment

{ 1 trackback }

Django Request Response processing — The Uswaretech Blog - Django Web Development « Netcrema - creme de la social news via digg + delicious + stumpleupon + reddit
June 25, 2009 at 3:40 am

{ 1 comment… read it below or add one }

1 Shalin Shekhar Mangar June 25, 2009 at 2:43 am

A Google App Engine application is also quite similar

This comment was originally posted on FriendFeed

Leave a Comment

Additional comments powered by BackType

Previous post:

Next post: