32

ホームディレクトリにDjangoプロジェクトを作成したので、ホームディレクトリにあります。

設定

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

の内容/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()

のつながりhttpd.conf

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

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

エラー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

の内容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)),
)

の権限/home/aettool/aet : 775

の権限/home/aettool/aet/apache : 755

の権限django.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 行しか追加されておらず、何が問題なのかを理解できないことです。

4

5 に答える 5

39

どうやらこれは Apache 2.4 以前のバージョンに関連する問題です。Apache 構成で次のように置き換える必要があります。

Allow from all

Require all granted

<Files wsgi.py>セクションで

于 2013-10-18T11:31:02.473 に答える
4

これは、Django チケット 19319 で報告されています。

https://code.djangoproject.com/ticket/19319

あなたの Apache 設定は、あなたのファイルのために以下を必要としますwsgi.py

<Directory /path/to/your/wsgi-script>
<Files wsgi.py>
  Order deny,allow
  Allow from all
  Require all granted
</Files>
</Directory>
于 2015-05-15T16:31:10.497 に答える
-1

Linux システムは通常、他のユーザーがホーム ディレクトリ内を読み取ることを許可しません。また、Apache がルートとして実行されるため、mod_wsgi はホーム ディレクトリ内にアクセスできません。試す:

sudo chmod 755 /home/<username>
于 2020-04-18T12:58:10.277 に答える