how to add python path in mod_python

ε祈祈猫儿з 提交于 2019-12-11 03:04:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!