Django + wsgi = Forbidden 403

女生的网名这么多〃 提交于 2020-01-17 03:51:04

问题


So 403 error is here. My 000-default.conf from /etc/apache2/sites-available/:

<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>

My wsgi.py from 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 here: http://pastebin.sabayon.org/pastie/16969


回答1:


In your settings.py, your allowed hosts are empty. You should complete as following :

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


来源:https://stackoverflow.com/questions/25038440/django-wsgi-forbidden-403

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!