问题
Hi I am using mod_python and I have a python module AA in a directory X and in directory X I have sub directories which has other modules which are imported in AA. I am importing AA in BB. when I run BB it fails to load modules imported in AA.
It's a python path issue, but the issue is how to dynamically set the path to the users workspace.
the workspace differs for each users.
Please help me on this.
to update I am using
sys. path.append(classpath)
in my BB script but still it fails.
my vhost file has following added in Directory tag :
AddHandler cgi-script .py
PythonHandler mod_python
PythonDebug On
回答1:
Python path can be added using the PythonPath directive. It should work in the server, virtual host, directory and .htaccess contexts.
PythonPath "['/path/to/site1', '/path/to/site2']"
http://modpython.org/live/current/doc-html/directives.html#pythonpath
来源:https://stackoverflow.com/questions/28688306/how-to-add-python-path-in-mod-python