[mod_python] Difference between run the web service standalone and via mod_python

Jim Gallacher jpg at jgassociates.ca
Tue Jul 18 09:25:15 EDT 2006

wang yingqi wrote:
> hi everyone!
> some excellent python web framework has its own web-service instance,Just
> like Quixote & Djanso, that means we can run our web service without Apache
> etc.
> so could anybody tell me what's the difference between these modes:1,run
> the
> service standalone of the python web framework 2,attach the python web app
> to Apache via mod_python..
> thank u!

Consider the following points:

1. Performance

The standalone servers will serve all content, including static content.
Since they are likely written in pure python, their performance for
static content likely be slower.

Whether this is an important factor will depend on the mix of static vs
dynamic content. If the ratio of static/dynamic is high, using apache +
mod_python will likely be better.

2. Server management

If the host is not running apache, it will be easier to use the
standalone server.

If the host is already running apache, it may be simpler to use
mod_python rather than managing a separate application server.

If the user wants multiple instances of the application, they will need
to run and manage additional standalone servers, as opposed to apache
where it will just be an extra configuration stanza.

There is also the issue of contention for port 80. What if you need
different standalone application servers such as Trac for issue tracking
and Quixote for some other web service. Only one of them will be able to
use port 80, while the other will need to use a non-standard port. This
could be a PITA, and indeed some corporate users may not be able to
access the second application due to firewall restrictions.

3. Virtual hosts

The standalone server may not support virtual hosts. To me this would be
a show stopper.

4. Apache goodness

There are a wealth of apache modules which may be useful, with no
equivalent in the standalone server.

Apache is robust. Some applications (such as Zope) recommend that the
Zope server be used behind apache as an extra bit of insurance against
the malicious requests. (Or at least this used to be the recommendation.
I don't follow Zope development anymore and this may have changed).

These comments may seem biased towards Apache, but then consider the
source - mod_python is an Apache module after all. ;)


More information about the Mod_python mailing list