[mod_python] Big Issue w/ sys.path

Daniel West dwmp at opti.cgi.net
Sun Feb 8 12:45:19 EST 2004


At 10:34 AM 2/8/2004 -0800, you wrote:
>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.

PythonPath is supported in the virtual host config.  Perhaps you could 
structure your test and development into different virtual hosts.

-Dan



More information about the Mod_python mailing list