[mod_python] avoiding apache restarts to reimport modules and refresh global cache

Huzaifa Tapal huzaifa at hostway.com
Thu Sep 15 10:24:58 EDT 2005

I have been using my python based web application framework, slither, 
which was recently upgraded to be a mod_python handler for more than 6 
months now for various applications at my company.  One dillema I see 
with the persistent environment with mod_python is that everytime I 
update code in production, i have to restart apache so that my library 
modules can be reloaded as well as any caching I am using.

 I am using apache.import_module() to import any page modules in my 
applications and those get reimported at every change since they have 
the autoreload turned on.  I also know that Vampire has a pretty good 
module importing system then that provided by apache.import_module().  I 
was wondering if it would be a good idea overwrite the 
__builtin__.import() method with that of Vampire's import_module or 
apache.import_module() so that the checks of "mtime" are done and the 
reloads happen automatically.

Is there another better way of reloading all my library modules and 
refreshing the cache?


More information about the Mod_python mailing list