/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 是示例项目中应用程序的名称
最佳答案
如果 polls 是示例项目中应用程序的名称,则您的 example.conf 文件可能应该包含以下行:
<Directory /var/www/example/polls>
而不是这个:
<Directory /var/www/polls>
关于django - 文件不存在 :/var/www/polls,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29681820/