|
Daniel Popowich
dpopowich at comcast.net
Sun Jul 11 11:49:39 EDT 2004
> In the mps_tutorial, every time i change any .mps or _TutorialBase.py i
> need to restart apache so that changes take affect?
You shouldn't need to restart apache if you modify a mps file: an
internal cache of the Servlet handler maintains modification times of
mps files and if the version on disk is newer than that in the cache,
the file is re-loaded. (For the curious, this code is in
mod_python.servlet._servlets_manager.__load_servlet.)
However, py files are another matter. My favorite trick for
development/debugging is to modify the apache directive,
MaxRequestsPerChild. Assuming you're using the prefork MPM:
<IfModule prefork.c>
...
#MaxRequestsPerChild 1000
MaxRequestsPerChild 1
...
</IfModule>
You DEFINITELY don't want this in production as it will reload the
python interpreter for each request, but the nasty issue of reloading
modified python modules goes away in a hurry.
The mod_python FAQ offers another trick, using the python reload
built-in, but that forces you to put code in your apps to manage the
reloads.
Cheers,
Daniel
|