Django + wsgi =禁止403 [英] Django + wsgi = Forbidden 403

查看:126
本文介绍了Django + wsgi =禁止403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此403错误在这里. 我的/etc/apache2/sites-available/中的000-default.conf:

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>

我的srv/sampleapp/sampleapp中的wsgi.py:

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此处: http://pastebin.sabayon.org/pastie/16969

settings.py here: http://pastebin.sabayon.org/pastie/16969

推荐答案

在您的settings.py中,您允许的主机为空.您应该完成以下步骤:

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

这篇关于Django + wsgi =禁止403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆