[mod_python] Howto force reload of all modules

Graham Dumpleton graham.dumpleton at gmail.com
Thu Aug 30 21:48:55 EDT 2007


On 31/08/2007, hhanke at pdx.edu <hhanke at pdx.edu> wrote:
>
> Hello,
>
> please, I'm using apache.import_module() to import my modules
> in mod_python 3.2.8 (I'm stuck with this version on our
> production server). Since it has its problems, please, what
> is the easiest way to reload all modules?
>
> Is there some Apache directive or some apache. method which
> would allow me to ask for all modules to be reloaded
> on next access?

The only reliable way is to restart the whole of Apache.

If it were a development server, you could also use the brute force
method of having the Apache child process restart after every request.
This is done using the Apache directive:

  MaxRequestsPerChild 1

This should however never be used on a production server, as it would
give CGI like performance.

In short, there is no good way of doing it. Even the module importer
in 3.3.1 is only of use to web application code which is managed by
mod_python and not normal Python modules on sys.path.

Graham


More information about the Mod_python mailing list