gpt4 book ai didi

python - WSGIPythonPath应该在我的virtualenv中指向何处?

转载 作者:行者123 更新时间:2023-12-03 13:29:57 24 4
gpt4 key购买 nike

在虚拟环境中,我在python2.7内部有一个名为lib的文件夹。

在阅读了六篇教程之后,我无法弄清楚我想把WSGIPythonPath指向什么。我见过一些指向site-packages的指针,但有些却是用冒号:分隔的列表。

Syntax error on line 1019 of /etc/httpd/conf/httpd.conf:
WSGIPythonPath cannot occur within <VirtualHost> section

WSGIPythonPath应该在我的virtualenv中指向何处?

最佳答案

您收到错误消息是因为 VirtualHost 上下文内无法使用 WSGIPythonPath 指令。您必须在主Apache配置文件中声明它。如果仍要指向VirtualHost上下文中的virtualenv中的目录,请改用 WSGIDaemonProcess 伪指令,它具有python-path选项供您声明相关的python目录。

例如:您的虚拟主机配置文件应如下所示:

<VirtualHost *:80>
ServerName example.com
CustomLog logs/example.com-access_log common
ErrorLog logs/example.com-error_log

WSGIDaemonProcess example.com python-path=/virtualenvpathto/site-packages:/pathto/exampleprojecthome
WSGIProcessGroup example.com

...
</VirtualHost>

完整的冒号 :用于以下情况:要将多个python目录添加到$ PYTHON_PATH环境变量,以便说 import example.foo 可以正常工作。在上面的示例中,有两个目录,根据您如何设置项目,它们可以更多或更少。

如果您在Windows上,请使用分号;而不是全冒号。

我希望这有帮助。

关于python - WSGIPythonPath应该在我的virtualenv中指向何处?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27832777/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com