[mod_python] How to stop reimporting modules

Jim Gallacher jg.lists at sympatico.ca
Sat Apr 9 12:56:43 EDT 2005


Barry Pearce wrote:
> Hi,
> 
> This is an interesting issue - I have my own handler but I have a 
> problem where mod_python does NOT cause modules to be reloaded - despite 
> having changed on the disk I would have expected the module to 
> reload...but it stays the same until I restart the web server - perhaps 
> there is something Im doing wrong!!
> 
> I really dont want to restart the apache server to upgrade my software - 
> it kills all current sessions and downloads....
> 
> Any ideas?

My impression is that the handler specified in the apache PythonHandler 
directive does not get reloaded when changed. Of course I may be 
completely off the mark here.

For my code, the PythonHandler cms.publisher is just a stub that does a 
little pre-processing and then uses apache.import_module() to get my 
real handler. It's apache.import_module that does the reloading magic, 
and so I avoid restarting apache when my handler code changes. I figure 
once my code has pretty much settled down, I can change the 
PythonHandler to specify the real handler.

Regards,
Jim




More information about the Mod_python mailing list