Python web frameworks

Graham Dumpleton Graham.Dumpleton at
Tue Nov 20 22:39:01 CET 2007

On Nov 21, 2:33 am, Istvan Albert <istvan.alb... at> wrote:
> On Nov 20, 9:42 am, "Diez B. Roggisch" <de... at> wrote:
> > > 12/7. Django comes with its own little server so that you don't have
> > > to set up Apache on your desktop to play with it.
> > I was rather shocked to learn that django only has this tiny server and does
> > not come with a stand-alone server
> Alas it is even worse than that, the development server is single
> threaded and that can be a big problem when developing sites that make
> multiple simultaneous requests at the same time (say if one of those
> requests stalls for some reason). It is trivial to add multi threading
> via a mixin (takes about two lines of code) but it does not seem to be
> a priority to do so.
> For large traffic though, Django is better than just about anything
> other framework because it is built as multiprocess framework through
> mod_python (rather than threaded).

This only holds if actually hosted on Apache. As Django these days
supports WSGI interface there is nothing to stop it being run with
other hosting solutions that support WSGI. So, you could host it under
paster or CherryPy WSGI servers. You could even run it under CGI if
you were really desperate using a CGI-WSGI adapter. So, it isn't
strictly correct to say it is as a multiprocess framework specifically
for mod_python, although the developers will admit in the first
instance that they didn't design the internals with multithreading in
mind. That said, there aren't believed to be any multithreading issues
in Django itself at this time.

> So there is no global interpreter
> lock, thread switching etc.

Use of worker MPM (multiprocess+multithreaded) in Apache in place of
prefork MPM (multiprocess+single threaded) is also still more than
acceptable a solution to hosting Python web applications using either
mod_python or mod_wsgi.

People keep pushing this barrow about the GIL and multithreading being
a huge problem, when in the context of Apache it is isn't, at least
not to the degree people make out. The reason for this is that when
using worker MPM it sill acts as a multi process web server even
though each process is also multithreaded. Within those worker MPM
child processes there is also a lot going on that doesn't involve
Python code nor the GIL, for example initial request process and
serving up of static files etc.

Result is that the Python GIL is no impediment when using Apache on
UNIX to making good use of multiple processors or cores, even when
Apache worker MPM is used.

For where I have talked about this before see:


More information about the Python-list mailing list