[mod_python] mod_python executing old versions of my code

Mike Looijmans nlv11281 at natlab.research.philips.com
Thu Jan 26 01:40:50 EST 2006

When faced with the reload problem a few years ago, I created a special 
"reload" request. The request would list all the .py[oc] files in the 
script folder, and tries to unload or reload() each of them.

As a result, the "main" modules as well as dependent modules will have 
been reloaded or removed (At least, the ones that came from my project - 
it would not make sense to unload modules like 'os').

So just sending "http://myhost/pu/reload" to the server would cause the 
next request to get all new scripts.

I even used this on the production server after uploading updates.

Mike Looijmans
Philips Natlab / Topic Automation

James Paige wrote:
> Daniel Nogradi wrote:
>>> I'm new to mod_python... so maybe I have missed something fundamental
>>> here, but mod_python seems to be keeping several copies of my old code
>>> in memory, so when I make changes and reload the page, sometimes I get
>>> my changes, and sometimes I get a seemingly-random version of the code
>>> that I have already changed.
>> You can also try setting the MaxRequestsPerChild apache directive to 
>> 1, it
>> worked for me very well. Initially I had the same problem like you, 
>> but with
>> MaxRequestsPerChild 1
>> in the apache config file the problem is gone because every child that 
>> loads
>> your code dies after the request, so it doesn't stay anywhere.
> That sounds like it would be an excellent workaround if I was using a
> dedicated server that ran nothing but mod_python, but for a shared
> server-- especially one on which I might not necessarily have root
> access at all, that will not work.
> ---
> James Paige
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list