HOWTO配置Apache WSGI为多个独立的Django的实例? [英] Howto configure Apache WSGI for multiple separate Django instances?

查看:210
本文介绍了HOWTO配置Apache WSGI为多个独立的Django的实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Apache实例,其中我有以下

I have an apache instance where I have the following

WSGIPythonPath /production/somelocation/django12/lib/python2.4/site-packages/
<VirtualHost 192.168.1.1:443>
        WSGIScriptAlias / /opt/project.wsgi
        .....

我的Django 1.5应用的Apache配置的样子,

My Django 1.5 app apache config looks like,

WSGIPythonPath /production/somelocation/django15/lib/python2.7/site-packages/
<VirtualHost 192.168.1.2:443>
        ....
        WSGIScriptAlias / /opt/project2.wsgi

我/opt/project.wsgi看起来像

My /opt/project.wsgi looks like

import os
import sys

# django1.2 virtualenv
import site
site.addsitedir("/production/somelocation/django12/lib/python2.4/site-packages")
.....

然而,当我去到现场我仍然得到我的默认的Django(1.5)的实例。我缺少什么?

However when I go to the site I still get my default django (1.5) instance. What am I missing ?

推荐答案

其他答案提设定Python路径,但使用WSGIPythonPath或WSGIPythonHome是不正确的。该WSGIPythonPath / WSGIPythonHome只能将服务器级,每个虚拟主机所以没有不同的路径。

The other answers mention setting the python path, however using WSGIPythonPath or WSGIPythonHome are not correct. The WSGIPythonPath / WSGIPythonHome can only be set server-wide, so no different paths per virtualhost.

您会想使用WSGIDaemonProcess 蟒蛇路径首页参数来设置Python路径和每个虚拟主机您的应用程序的主目录。

You would want to use the WSGIDaemonProcess python-path and home arguments to set the python path and your apps home directory per virtualhost.

另外,你的code中有没有必要调整蟒蛇的路径;只要确保你的虚拟主机配置是正确的。

Also, within your code there is no need to adjust python paths; just make sure your virtualhost config is correct.

这篇关于HOWTO配置Apache WSGI为多个独立的Django的实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆