|
Gregory (Grisha) Trubetskoy
grisha at modpython.org
Tue Aug 26 15:01:02 EST 2003
Hi Barry -
Try
PythonPath "sys.path + ['/path/to/project/zope2/lib/python',
'/path/to/project/xxx/xxx_apps']"
(the above should be on one line)
IIRC, mod_python will prepend the path in <Directory> to sys.path, unless
PythonPath is specified, in which case PythonPath overrules everything.
Grisha
On Tue, 26 Aug 2003, Barry Warsaw wrote:
> FTR: Apache 2.0.47, mod_python 3.0.3, Python 2.3+LONG_LONG patch
> (although I've also tried Python 2.2.3).
>
> I'm having trouble with the PythonPath directive. Mostly likely I don't
> understand how it's supposed to work. Here are my Apache directives:
>
> LoadModule python_module /usr/local/apache/modules/mod_python.so
>
> <Directory /path/to/project/xxx/xxx_apps>
> AddHandler python-program .py
> #PythonPath "sys.path + ['/path/to/project/zope2/lib/python']"
> PythonHandler regserver.driver
> PythonDebug On
> </Directory>
>
> ScriptAlias /regserver/ "/path/to/project/xxx/xxx_apps/"
>
> When I hit http://localhost/regserver/driver.py with the PythonPath
> directive commented out, everything works fine. But when I uncomment
> the PythonPath directive, I get an import error:
>
> Mod_python error: "PythonHandler regserver.driver"
>
> Traceback (most recent call last):
>
> File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py", line 320, in HandlerDispatch
> module = import_module(module_name, config)
>
> File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py", line 496, in import_module
> f, p, d = imp.find_module(parts[i], path)
>
> ImportError: No module named regserver
>
> I thought that the way I'm specifying PythonPath above should have added
> to sys.path, not overwritten it. What am I missing?
>
> Thanks,
> -Barry
>
> P.S. there is a buglet in the online manual. It says that --with-apxs
> searches /usr/local/apache/bin but it really appears to search only
> /usr/local/apache/sbin. While my apxs lives in the former, I had to use
> the --with-apxs configure option for it to find it.
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
|