5

私は最近 virtualenvwrapper を使い始めて作成しました

mkdir ~/.virtualenvs
mkvirtualenv example.com

Virtualenvwarpper は ~/.virtualenv の下に example.com という名前の virtualenv を自動的に作成するため、これがすべての virtualenv の中心的なコンテナーになります。pip経由でdjangoと他のいくつかのパッケージをインストールした後、私のサイトは

 /srv/www/example.com/public_html/

/srv/www/example.com/public_html の下のサイトで example.com virtualenv を使用できない場合、サイトを ~/.virtualenv/example.com に配置する必要がありますか。このデプロイ用の apache mod_wsgi 構成を見せてもらえますか? ありがとう

4

2 に答える 2

4

Read:

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

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.

于 2010-08-11T23:48:03.487 に答える
2

WSGI スクリプトで:

import site
site.addsitedir('/home/username/.virtualenvs/example.com/lib/python2.5/site-packages')

(Pythonのバージョンなどに合わせて適宜調整してください)

于 2010-08-11T20:11:46.227 に答える