[mod_python] mod_python module path

Nick nick at dd.revealed.net
Tue Nov 8 17:51:06 EST 2005


For performance reasons, it's always faster to do

if PYPATH not in sys.path: sys.path.append(PYPATH)

rather than to raise and handle an exception.

Nick

jelle wrote:
> 
> 
> What works for me in the python file and prevents redundant path entries:
> 
> PYPATH = '/home/somegroovypath/my/py'
> import sys
> try: sys.path.index(PYPATH)
> except: sys.path.append(PYPATH)
> 
> 
> On Tue, 8 Nov 2005, Jorey Bump wrote:
> 
>> Pedro Ferreira wrote:
>>
>>> Hello all.
>>> I'm starting with mod_python, and I'm thinnking about developing a 
>>> web application using it. However, I have some python packages of my 
>>> own, that i wanted to use, and don't know how to add them to the 
>>> module path. I made a symlink in site-packages, to my module 
>>> directory, and it works. However, I'll need to do it without 
>>> administrator privileges. How is it possible? Is there any variable I 
>>> should change?
>>
>>
>> I use the PythonPath directive in my virtual host configuration:
>>
>> PythonPath "['/var/www/vhosts/www.example.com/python'] + sys.path"
>>
>> For more info, see:
>>
>> http://www.modpython.org/live/current/doc-html/dir-other-pp.html
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
> _______________________________________________
> 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