在虚拟环境中,lib内有一个名为python2.7的文件夹.
I have a folder called python2.7 inside of lib in the virtual environment.
在阅读了六篇教程之后,我无法弄清楚我想把WSGIPythonPath指向什么.我见过一些指向site-packages的指针,但有些是由冒号:分隔的列表.
After reading half a dozen tutorials, I can't figure out exactly what I'm suppose to point the WSGIPythonPath to. I've seen some pointing to site-packages but some have been a colon : separated list.
Syntax error on line 1019 of /etc/httpd/conf/httpd.conf: WSGIPythonPath cannot occur within <VirtualHost> sectionWSGIPythonPath应该在我的virtualenv中指向何处?
Where should WSGIPythonPath point in my virtualenv?
推荐答案您会收到错误消息,因为 VirtualGI 上下文中无法使用 WSGIPythonPath 指令.您必须在主Apache配置文件中声明它.如果仍要指向VirtualHost上下文中virtualenv中的目录,请改用 WSGIDaemonProcess 指令,它具有一个python-path选项供您声明相关的python目录.
You are getting the error because WSGIPythonPath Directive cannot be used inside the VirtualHost context. You have to declare it inside your main Apache configuration file. If you still want to point to the directories in your virtualenv inside the VirtualHost context, Use WSGIDaemonProcess Directive instead, it has a python-path option for you to declare your relevant python directories.
例如:您的虚拟主机配置文件应如下所示:
For example: your virtual host configuration file should look something like this:
<VirtualHost *:80> ServerName example CustomLog logs/example-access_log common ErrorLog logs/example-error_log WSGIDaemonProcess example python-path=/virtualenvpathto/site-packages:/pathto/exampleprojecthome WSGIProcessGroup example ... </VirtualHost>当您有多个要添加到$ PYTHON_PATH环境变量的python目录时,使用全冒号:,这样说 import example.foo 可以正常工作.在上面的示例中,有两个目录,根据您如何设置项目,它们可以更多或更少.
The full colon : is used when you have more than one python directories you want to be added to $PYTHON_PATH environment variable so that say import example.foo works fine. In the above example, there are two directories, they could be more or less depending on how you have setup your project.
如果您在Windows上,请使用分号;而不是完整的冒号.
If you are on windows, use semicolon ; instead of full colon.
我希望这会有所帮助.
更多推荐
WSGIPythonPath应该在我的virtualenv中指向何处?
发布评论