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

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

最佳答案

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

<Directory /var/www/example/polls>

而不是这个:
<Directory /var/www/polls>

关于django - 文件不存在 :/var/www/polls,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29681820/

相关文章:

django - 奇怪的django字符输入

删除 SSL 证书后 Apache2 不工作

apache - "Job for httpd.service failed because the control process exited with error code."我该如何解决这个问题?

python - 为什么我用sqlite的时候django需要psycopg2?

mysql - 在具有在全局 python2.7 下运行的预先存在的 Flask 应用程序的计算机上使用 python 3.4 virtualenv 让 Django Apache Mysql WSGI 工作

python - sleep() 是否阻止了 Django 中请求的处理?

python - Django updateview 表单验证错误未显示在模板中

python - 从命令行执行 Django Shell 命令

php - DVWA 设置 PHP 函数 allow_url_include : Disabled

python - apache 日志中没有任何内容的 500 错误