mod_python: delay in files changing after alteration

Graham Dumpleton Graham.Dumpleton at gmail.com
Tue Jan 6 18:31:29 EST 2009


On Jan 6, 2:39 am, "psaff... at googlemail.com" <psaff... at googlemail.com>
wrote:
> Maybe this is an apache question, in which case apologies.
>
> I am runningmod_python3.3.1-3 on apache 2.2.9-7. It works fine, but
> I find that when I alter a source file during development, it
> sometimes takes 5 seconds or so for the changes to be seen. This might
> sound trivial, but when debugging tens of silly errors, it's annoying
> that I have to keep hitting refresh on my browser waiting for the
> change to "take". I'm guessing this is just a caching issue of some
> kind, but can't figure out how to switch it off. Any suggestions?
>
> The entry in my apache2.conf looks like this:
>
> <Directory /var/www/pythonapps>
>    SetHandlermod_python
>    PythonHandlermod_python.publisher
>    PythonDebug On
> </Directory>

If the change is to a Python module installed on sys.path the change
would never be reloaded by a process. If you are seeing a delay, it is
probably only because the request is being handled by a different
Apache child process that has never loaded the code before. This is
all because Apache is a multiprocess web server on UNIX.

Thus, any changes to modules/packages installed on sys.path require a
full restart of Apache to ensure they are loaded by all Apache child
worker processes.

So, which code files are you actually modifying, ie., where do they
exist and how are they imported?

Graham




More information about the Python-list mailing list