【发布时间】:2015-06-23 06:41:30
【问题描述】:
/var/www 中 example.wsgi 文件的内容
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('~/.virtualenvs/menv/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/var/www/example')
sys.path.append('/var/www/example/example')
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/.virtualenvs/menv/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
example.conf 的内容
<VirtualHost *:80>
ServerAdmin webmaster@mydomain.com
ServerName example.redirectme.net
ServerAlias www.example.redirectme.net
WSGIScriptAlias / /var/www/example.wsgi
<Directory /var/www/polls>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
polls 是示例项目中应用的名称
【问题讨论】:
-
我认为问题出在 wsgi 文件上。当我编辑 wsgi 文件并尝试产生一些错误并重新启动服务器后。没有与 wsgi 文件相关的错误。
-
哪个 django 版本?哪个wsgi?哪个蟒蛇? wsgi 是为相同的 Python 版本编译的吗?错误在哪里?是500吗?来自 apache 的任何错误日志?
标签: django apache mod-wsgi vps digital-ocean