[mod_python] importing egg format libs installed on a custom path

Graham Carlyle graham.carlyle at maplecroft.net
Thu Sep 13 09:53:02 EDT 2007


Hi

I'm trying to setup an application via mod_python and want to place some
required libraries, that are python eggs, on an application specific
path.

So I use...

<LocationMatch ...>

...
PythonPath "['/opt/apps/foo/lib/'] + sys.path"
PythonInterpreter foo
...

</LocationMatch>

But the application doesn't pick up on the eggs that were installed in
"/opt/apps/foo/lib/". Although the python shell can import the libs
after setting PYTHONPATH to this path.

However I can get the webapp to find the eggs if I add to the apache
conf...

PythonImport /opt/apps/foo/lib/site.py foo

site.py being a file the easy_install created when i installed the eggs
to the custom path.

Is this the recommended way of installing eggs to a custom path? Are
there problems with this "solution". 

I had a trawl and couldn't find any info on this sort of problem in the
mailing list which surprised me.

thanks,
Graham




More information about the Mod_python mailing list