[mod_python] Reload scripts without restarting Apache?

Michael C. Neel neel at mediapulse.com
Mon Feb 9 10:56:21 EST 2004


> Sure is and I'm going to use it for development!!  The problem with
> doing manual reloads, conditional on some debugging state, is the
> complexity involved when you have deeply nested modules.  In the app
> I'm developing, I'm currently doing a lot of tweaking of code in a
> module imported a few modules down the pipe, as it were.  It's really
> HARD to get the re-importing logic down there AND it really doesn't
> want to be there because one of the intermediate modules has no
> knowledge of being used via mod_python.  Or maybe you're using a
> third-party module that allows plugins and you're working on the
> plugin -- you don't want to modify the third-party module to do
> conditional reloads -- UGLY!
> 

I believe you should be able to import any module you want in your
handler module, even if the handler doesn't use the module directly, and
have reload() work as expected.  This way you can keep any special debug
flag action in the handler module and the other modules never need to
know.

Another option is starting httpd with -X, in which it runs in single
process mode and I think dumps log info to the standard out.  If your
going MaxChild 1, might as well go the full monty with httpd -X =p

Mike



More information about the Mod_python mailing list