Django + wsgi =禁止403

时间:2014-07-30 13:41:39

标签: python django mod-wsgi

所以403错误就在这里。 来自/ etc / apache2 / sites-available /:

的000-default.conf
<VirtualHost talkrecorder.ru:80>
ServerName talkrecorder.ru
ServerAlias www.talkrecorder.ru
ServerAdmin mail@talkrecorder.ru
DocumentRoot /srv/www/sampleapp/
WSGIScriptAlias / /srv/www/sampleapp/sampleapp/wsgi.py
<Directory /srv/www/sampleapp>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

我的wsgi.py来自srv / sampleapp / sampleapp:

import os
import sys

sys.path.append('/srv/www/sampleapp/sampleapp')

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/sampleapp/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

settings.py此处:http://pastebin.sabayon.org/pastie/16969

1 个答案:

答案 0 :(得分:1)

在您的settings.py中,您允许的主机为空。您应完成以下操作:

ALLOWED_HOSTS = ['www.talkrecorder.ru', 'talkrecorder.ru'] #Or any other host that you need