Sunday 30 October 2011

[1] new discussion on LinkedIn

 
 
LinkedIn Groups
 
LinkedIn
 
 
 
 
October 30, 2011
 
NEW Groups in the LinkedIn app for iPhone » and Android »
 

Latest: Discussions (1) Members (100)

 
Discussions
 
Django Source Diving
 
Started by Ronald Harris, Python Programmer and CAD Technician
 
The heart of django is the request/response objects, and the request handlers. You can take a look at this somewhat old but still relevant post from james benett: http://www.b-list.org/weblog/2006/jun/13/how-django-processes-request/

Simplified: The request starts by invoking a handler, i.e. by using django.core.handlers.wsgi if you are using wsgi. It creates a request object, then a series of middleware clases are invoked, and the request hops through them, passing around the request object between them (at several stages), and returns a response if the middleware returns a response.

After the first run, and if none have returned a response by now, the url resolver kicks in and looks for a matching view, and the view is called (after some more middleware action).

If the view returns a response object, thus is returned to the browser (after some more middleware action). It's in the view that most users do their actual django work: use the ORM, the templating system, and so on.

If after all that no response objects have been created, the excpetion/error middleware kicks in and creates an error response object. (normally a 4xx/5xx error page)

If you want to dive into wsgi and this level, I would recommend starting out with a microframework, like flask, or checkout the webob code. http://webob.org/ , which is a python wsgi request/response wrapper. with flask or webob you would have your mini bare bone django, and you can add templating, ORM, or whatever on your own, to understand how they work.

Django is already a big beast, and covers A LOT of different technologies. It will take some time if you want to understand each piece from beginning till end.

Try using a debugger like in pycharm, where you can follow a request step by step and see what functions are being called and when. By Ashley Camba, Software Engineer at Novapost
 
Like · Flag
 
 
 
 

Don't want to receive email notifications? Adjust your message settings.

Stop inappropriate content the moment it is posted. Send me an email for each new discussion »

LinkedIn values your privacy. At no time has LinkedIn made your email address available to any other LinkedIn user without your permission. © 2011, LinkedIn Corporation.

 
 
 
 

No comments:

Post a Comment