mod_python confusion

Robert Brewer fumanchu at amor.org
Fri May 28 16:10:06 EDT 2004


Kylotan wrote:
> I thought mod_python would be the answer to my CGI performance issue,
> but I can't seem to make much sense out of it. All the examples are
> too trivial to be of much use.
> 
> Given that I have an application consisting of several CGI scripts,
> what is the simplest way to go about converting it to run on
> mod_python, not using the CGI-handler which is allegedly slow and
> buggy? Everything seems to suggest a major rewrite because I not only
> need to shift from printing everything to calling req.write or
> whatever, but I may also need to sort out some sort of dispatching
> mechanism mapping URLs to functions if I use mod_python directly. PSP
> doesn't work on my system as 3.1.2 gives me errors and the Win32
> installer for 3.1.3 fails at the last step (finding the Apache
> directory in the registry or something).

Given that webserver advocacy comes and goes, I always recommend
abstracting the webserver interface, so rewrites like the one you're
talking about hurt less:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/225299

I use that recipe to develop apps which run on Apache2 (Windows) or IIS
simply by turning off one server and turning on the other via the
Services applet.

Notice that recipe also includes a dispatch mechanism for mod_python.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list