[mod_python] Apache caching / reloading / restarting solution

Lars M. digital.spy at gmx.net
Sat Dec 4 05:39:47 EST 2004


Hi,

My problem always was that modules were cached and I couldn't call 
functions that were newly added to them without restarting Apache. This 
procedure takes ages here (XP Pro SP2). I tried various Apache directives 
to work around it, without any success, and was already considering PHP.

Then I gave the built-in Python function "reload(module)" a try - and it 
works flawlessly! I simply replaced all...

import module

...statements with...

import module
reload(module)

...statements and it seems changes to modules are reflected instantly. You 
could of course construct a conditional statement to only reload the 
modules during development.

BTW, as much as I like mailing lists, I think WWW-forums are much superior. 
The new beta version of "Google Groups" allows you to easily add new groups 
- wouldn't it be a good alternative?

Mailing lists feel a little clumsy.

Cheers,

-Lars



More information about the Mod_python mailing list