[mod_python] Loading the mod_python modules from somewhere other than site-packages

Jeff Stearns jps at savagebeast.com
Wed Feb 6 17:31:10 EST 2002


Folks -

I'm installing mod_python on a Linux box which can't allow anything to 
be installed within the site-python directory.  (The reasons for that 
are slightly interesting; the box operates as a virtual machine with 
many apache servers running different software versions, and the virtual 
machines would step on each other's copy of the mod_python files.)

Thus I wish to install the handful of mod_python/*.py files in the 
user's directory, not in the system-wide site-python directory.

I am running into trouble because I can't get mod_python to look 
elsewhere for these files. It seems to be using the wired-in default 
python path.

The PythonPath directive looks tempting, but it looks like a write-only 
variable. I don't think any piece of code actually uses this value.

I'm thinking of reworking the make_obcallback() function to use the 
value of PythonPath by poking it into sys.path before importing the 
mod_python modules.

Does this seem like the right strategy?  Is make_obcallback the right 
place to do this?  (I tried running apache -X under gdb to get a better 
idea of how apache and mod_python interact, but there's some problem 
with gad that's preventing me from using it at all here, alas.)

thx for your advice!

-jeff stearns




More information about the Mod_python mailing list