文件不存在:/ var / www / polls

时间:2015-04-16 17:21:49

标签: django apache mod-wsgi vps digital-ocean

/ 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是示例项目中的应用程序名称

2 个答案:

答案 0 :(得分:0)

如果polls是示例项目中应用程序的名称,那么example.conf文件应该包含以下行:

<Directory /var/www/example/polls>

而不是这一个:

<Directory /var/www/polls>

答案 1 :(得分:0)

Thanx试图提供帮助。我已经解决了这个问题。一切都是正确的。 我创建的conf文件未启用。所以我运行了以下命令。

a2ensite example.conf
相关问题