[mod_python] Big Issue w/ sys.path

jalil jalil at securia.com
Sun Feb 8 10:34:39 EST 2004


I  am running two mod-python apps on one apache server. One app is for 
development and the other is for testing. I just came across an 
interesting issue with sys.path that I am not sure how to resolve.

In my app, I have a pylib dir and I set the sys.path in the app to 
include this dir. I just noticed that I get to the test data in my 
development version (and sometimes vice versa randomly) and after 
spending sometime I realized that sys.path is shared b/w the two 
versions. I think Apache starts mod_python in one process and shares it 
across apps and when I set sys.path in one app it is visible to the 
other app. This cause my apps to randomly use each other environment 
libraries, which I don't want to happen at all as one is in development 
and one in testing.

Is there a way to keep the two apps completely isolated? I am using the 
pre-fork MPM in apache and just have separate paths on Apache to serve 
my apps.

Thanks,

-Jalil



More information about the Mod_python mailing list