[mod_python] mod_python or wsgi

Sean Allen sean at monkeysnatchbanana.com
Thu Jul 10 08:51:45 EDT 2008

On Jul 10, 2008, at 1:15 AM, Graham Dumpleton wrote:

> 2008/7/10 Sean Allen <sean at monkeysnatchbanana.com>:
>> We are doing a 'side port' from mod_perl over to python of a large  
>> mess of
>> code.
>> Largely because developers keep getting tripped up on the idiomatic  
>> nature
>> of OO perl.
>> The initial idea was to move everything to mod_python as it seemed  
>> the
>> closet sidestep.
>> Looking for advice on the validity of that idea. Would it be as  
>> easy to move
>> mod_perl code
>> to wsgi as mod_python?
>> i know the advantages of wsgi in terms of portability by that isnt  
>> the issue
>> right now,
>> getting it done as quickly and as easily as possible is.
>> thoughts? experiences? comments?
> Does your mod_perl code rely on being able to use Apache handler
> phases other than the content handler phase? How much does it depend
> upon mod_perl APIs to Apache libraries and internals? In other words,
> is it just a content provider, or is it doing more than that and
> hooking right into low levels of Apache?

We have one PostReadRequestHandler
All the rest of RequestHandlers

The PostReadRequestHandler does some across the board setup including  
the remote_ip in the connection to the value of X-Forwarded-For, if said
header exists and if the connection is being proxied.

Additionally, there is code that extracts media source tracking  
information from the uri and
sets up that info for whatever RequestHandler is executed afterwards.

The RequestHandlers themselves dont do much with the Apache specific  
using Apache::Request ( apr ) to extract request info and pass it back.

> [ snip ]
> Either way, I'd suggest there would be a fair bit of effort and using
> one of mod_python or some WSGI toolkit/framework over the other isn't
> probably going to save you much. So, more importantly, what sort of
> features do you need as far as dispatch, templating, session support,
> authentication, authorisation etc and at what level do you want to be
> able to program, right at the low level, or are higher level
> abstractions frameworks more desirable.

Templating is currently done using the perl TemplateToolkit, the plan  
is to
use the python version which from limited testing should be fairly easy.

The only session state we have is a single cookie so that isnt much of  
a concern.

We have custom code for doing dispatch, authentication etc.

More information about the Mod_python mailing list