Django / mod_wsgi AH01630:服务器配置拒绝客户端

时间:2015-11-28 06:13:31

标签: python django amazon-ec2

我正在将我的Django站点移动到Amazon EC2并尝试在Ubuntu 14.04.2 LTS上配置Apache2。

访问网站时出现错误:

[Sat Nov 28 05:55:54.799020 2015] [authz_core:error] [pid 1657] [client 110.143.63.231:65129] AH01630: client denied by server configuration: /home/directory/django.wsgi

我的django.wsgi文件是:

import os
import sys
sys.path.append('/home/directory/')
sys.path.append('/home/directory/directory/directory/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'  # this is your settings.py file
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

我的000-default.conf文件是:

<VirtualHost *:80>
    ServerName ip.add.res.s
    ServerAlias www.ip.add.res.s
    ServerAdmin example@email.com

    Alias /static/ /home/directory/static/
    <Directory "/static/">
        Options -Indexes
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    Alias /media/ /home/directory/media/
    <Directory "/media/">
        Options -Indexes
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    WSGIScriptAlias / /home/directory/directory/directory/django.wsgi

    <Directory "/home/directory/directory/directory">
        <Files django.py>
            Options All
            AllowOverride All
            Order allow,deny
            Allow from all
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

我对755拥有django.wsgi权限,并且ALLOWED_HOSTS = []

中设置了IP地址

一直在努力寻找解决方案。

1 个答案:

答案 0 :(得分:-2)

我认为如果您使用的话,可能必须包含WSGI文件。 wsgi.py