[mod_python] PythonAutoReload?

Byron Ellacott bje at apnic.net
Mon Aug 23 14:48:31 EDT 2004


Malcolm Lockyer wrote:
> from mod_python import apache
> from application import Authentication
> I noticed the PythonAutoReload directive, even though it defaults to on, 
> I added it to my .htaccess with no change. Also there isn't just a .pyc 
> in the application folder I can delete.

I'm not sure if this is really what goes on, but I believe the 
PythonAutoReload directive tells mod_python that when it needs a module 
to handle a request, it should automatically reload any changed modules.

This doesn't tell Python itself that all imports should reload changed 
modules.

There are two solutions here.  The first is to configure your Apache 
process to be more conducive to debugging: MaxRequestsPerChild of 1, or 
start it in single process mode, or something similar.  The second is to 
use:

from application import Authentication
if DEBUG_ON: reload(Authentication)

I'd probably go with the first solution, if practical.

-- 
bje


More information about the Mod_python mailing list