[mod_python] Reload scripts without restarting Apache?

Gerhard Venter loper at ananzi.co.za
Fri Feb 6 11:38:58 EST 2004


I found you don't need to restart Apache  (Apache  2 in my case) when
you've changed the script, only if you've changed the Apache directives.
I hope I'm not giving you bad advice here , but I think you should use
the publisher handler.  Then you don't need to change the Apache
directives if  you stick to the same script name (eg script.py) - with
the publisher handler you can do that, because all your scripts can be
functions within script.py:

import mod_python, os, sys, string
def dothis (req, x):
      #dothis actions

def dothat (req, y):
      #dothat actions

Then your various scripts are called as follows:

And all you need per directory in the Apache directives is:
   AddHandler python-program .py
   PythonHandler mod_python.publisher
   PythonDebug On

And you use only one .py per directory

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?
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list