[mod_python] Reload scripts without restarting Apache?

Adrian Holovaty modpython at holovaty.com
Fri Feb 6 16:02:04 EST 2004


Leif K-Brooks wrote:
> I'm getting started doing some development with mod_python, and I
> generally like to do a little bit at a time and test. That's made more
> difficult by having to restart Apache to get my new scripts used, and it
> would probably be worse on a production server. I don't want to lose
> performance, but is there  a way to make mod_python check if the script
> has changed or something?

I'd definitely *not* recommend doing this on a production server, but...

On my "development server" (a.k.a. my laptop), I've set this in httpd.conf:

MaxRequestsPerChild  1

That way, regardless of the PythonReload directive, each Apache child will 
only live long enough to serve one request. Which means the Python 
interpreter will restart for every request and you can always be certain 
there isn't any weird module caching voodoo going on.

Adrian



More information about the Mod_python mailing list