一尘不染

Django和mod_wsgi的403禁止的错误

django

我在主目录中创建了Django项目,因此它位于主目录中。

设定

Django Verison  : 1.5.1
Python Version  : 2.7.5
mod_wsgi Version: 3.4
Home Directory  : /home/aettool

Contents of /home/aettool/aet/apache/django.wsgi

import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'aet.settings'

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

Contect of httpd.conf

WSGIScriptAlias / /home/aettool/aet/apache/django.wsgi

<Directory /home/aettool/aet/apache>
Order deny,allow
Allow from all
</Directory>

Error in error_log

[Sun Jul 21 02:01:30.923364 2013] [authz_core:error] [pid 21540:tid 1193011520] [client 10.20.17.184:51340] AH01630: client denied by server configuration: /home/aettool/aet/apache/django.wsgi

Contents of urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

Permissions of /home/aettool/aet : 775

Permissions of /home/aettool/aet/apache : 755

Permissions ofdjango.wsgi file : 664

我在浏览器上遇到错误 403 Forbidden You don't have permission to access / on this server.

请帮助我进行配置。

编辑

目前,我正在通过改变前进

<Directory />
    AllowOverride none
    Require all denied
</Directory>

<Directory />
    Order deny,allow
    Allow from all
</Directory>

因此,这肯定与httpd.conf文件配置有关,但我担心的是,我在该文件中仅添加了5行,却无法找出问题所在。


阅读 366

收藏
2020-04-03

共1个答案

一尘不染

显然,这是与Apache 2.4和更早版本有关的问题。你需要在apache配置中进行替换:

Allow from all

Require all granted

在本<Files wsgi.py>节中

2020-04-03