[mod_python] Reload scripts without restarting Apache?

Michael C. Neel neel at mediapulse.com
Fri Feb 6 17:32:56 EST 2004


> 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
> 
Heh... wow.  That's one way to do it =p

Search the mail archives and you'll find this question has come up a few
times.  You can use apache.import to let mod_python decide when to
reload a module (I think it's called apache.import), or you can call
reload yourself.  I choose the latter, and tie it to the PythonDebug
setting, i.e.
	
	import mymod1, mymod2

	def handler(req):
		if req.config.has_key('PythonDebug'):
			reload(mymod1)
			reload(mymod2)

(syntax may not be right there, going from memory atm).  There were some
other method listed as well, can't recall what they were atm.

Mike



More information about the Mod_python mailing list