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

编程入门 行业动态 更新时间:2024-10-27 18:24:55
本文介绍了WSGIPythonPath应该在我的virtualenv中指向何处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在虚拟环境中,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> section

WSGIPythonPath应该在我的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中指向何处?

本文发布于:2023-10-27 18:23:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534170.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WSGIPythonPath   virtualenv

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!