Ive wasted about 3 days trying to get apache working with django and getting very frustrated.
Ive read
https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
The configuration differs between the links and I suspect they are a bit outdated now with django 1.4
The error im facing in the apache log is
(13)Permission denied: access to / denied
Environment:
Python 2.62
Centos 6.2 on Windows Azure
Apache/2.2.15
Django 1.4
Paths:
/home/craig/django/myproject/myproject/wsgi.py
Permissions:
/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()
This problem was immediately fixed by disabling SELINUX by running the following command:
setenforce 0
This probably isnt best pratice, but for development purposes it did the job for me