我浪费了大约 3 天时间试图让 apache 与 django 一起工作并且非常沮丧。我读了
https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
链接之间的配置不同,我怀疑它们现在有点过时了 django 1.4 我在 apache 日志中面临的错误是
(13)Permission denied:访问/拒绝
环境:
蟒蛇 2.62
Windows Azure 上的 Centos 6.2
阿帕奇/2.2.15
姜戈 1.4
路径:
/home/craig/django/myproject/myproject/wsgi.py
权限:
/home/:drwxrwxr-x
/home/craig/:drwxrwxr-x
/home/craig/django/:drwxrwxr-x
/home/craig/django/myproject/:drwxrwxr-x
/home/craig/django/myproject/myproject/:drwxrwxr-x
/home/craig/django/myproject/myproject/wsgi.py:-rw-r--r--
http.conf:
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/craig/django/myproject/myproject>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
WSGIScriptAlias / /home/craig/django/myproject/myproject/wsgi.py
WSGIPythonPath /home/craig/django/myproject
<VirtualHost *:80>
ServerName myserver.domain.net
</VirtualHost>
wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()