Django virtualenv部署配置 [英] Django virtualenv deployment configuration

查看:210
本文介绍了Django virtualenv部署配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用virtualenvwrapper并创建了

I recently start to use virtualenvwrapper and created

mkdir ~/.virtualenvs
mkvirtualenv example.com

Virtualenvwarpper在〜/ .virtualenv
下自动创建一个名为example.com的virtualenv,所以这是中央所有virtualenvs的容器。
比我安装django和一些其他包通过pip
和我的网站在

Virtualenvwarpper automatical create a virtualenv named example.com under ~/.virtualenv so this is the central container for all virtualenvs. After than I installed django and some other packages via pip and my site is at

 /srv/www/example.com/public_html/

我必须将我的网站设置为
〜/ .virtualenv / example.com
如果不是我可以如何使用我的example.com virtualenv与我的网站在/srv/www/example.com/public_html。
你可以给我看看这个部署的apache mod_wsgi配置吗?
谢谢

Do I have to put my site to ~/.virtualenv/example.com if not how could I use my example.com virtualenv with my site under /srv/www/example.com/public_html. Could you show me an apache mod_wsgi configuration for this deployment? Thanks

推荐答案

阅读:

http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

只能使用site.addsitedir(),因为它不处理某些排序问题可能不够。你最好使用mod_wsgi提供的配置指令/选项来添加它们。否则,如果排序成为一个问题,您将需要添加代码到WSGI脚本,根据需要重新排序sys.path。

It may not be sufficient to use just site.addsitedir() as it doesn't deal with certain ordering issues. You are better off using the configuration directive/option provided by mod_wsgi to add them. Otherwise, if the ordering becomes an issue you will need to add code into WSGI script that reorders sys.path as necessary.

这篇关于Django virtualenv部署配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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