[mod_python] module reloading

Graham Dumpleton grahamd at dscpl.com.au
Thu Jul 13 23:11:29 EDT 2006


David Harvey wrote ..
> I'm having issues with ye olde module reloading.
> 
> i.e. modules don't reload, need to restart server, yadda yadda yadda.
> 
> Even touching all my .py and .pyc files doesn't seem to help... it  
> still seems to require a restart.
> 
> I see there have been frequent posts about this issue on this list,  
> and it sounds like it's not quite resolved yet.
> 
> I'm wondering if there's a simple line or two of code I can add to my 
> entry point, before any importing happens, which will clean out the  
> module cache? Just unload everything to force a reload of everything? 
> That would work quite well for me during development.

Nothing that works reliably.

Rather than modify your Python code, some people during development will
setup Apache such that max requests per child is 1. That way a new process
is created for every request. It will be slow, but you are reasonably assured
that latest modules will be there.

The only other alternative is to use mod_python out of the subversion source
code repository trunk and enable the new module importer which addresses
the bulk of the problems with the existing module loader.

For background on current module importer problems, you should read:

  http://www.dscpl.com.au/articles/modpython-003.html

Graham


More information about the Mod_python mailing list