views:

366

answers:

0

I am trying to setup apache with mod_wsgi to serve Django through a nginx proxy on CentOS 5.4. I want to start by configuring Apache with Wsgi to serve on a local port, but I get a 403 error when I run curl localhost:8080

# Httpd config:
Listen 127.0.0.1:8080
NameVirtualHost 127.0.0.1:8080

<VirtualHost 127.0.0.1:8080>
    ServerName staging.example.com

    LogLevel warn
    ErrorLog  /home/django/project_name/log/apache_error.log
    CustomLog /home/django/project_name/log/apache_access.log combined

    DocumentRoot /home/django/project_name/django_project_dir/

    WSGIDaemonProcess staging.example.com user=apache group=apache threads=25
    WSGIProcessGroup staging.example.com
    WSGIScriptAlias / /home/django/project_name/django_project_dir/django.wsgi

    <Directory /home/django/project_name/django_project_dir>
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

And my wsgi script:

#/home/django/project_name/django_project_dir/django.wsgi
ALLDIRS = ['/home/django/project_dir/virtualenv/lib/python2.4/site-packages']

import os
import sys
import site

prev_sys_path = list(sys.path)

for directory in ALLDIRS:
    site.addsitedir(directory)

new_sys_path = []
for item in list(sys.path):
    if item not in prev_sys_path:
       new_sys_path.append(item)
       sys.path.remove(item)
sys.path[:0] = new_sys_path


sys.path.append('/home/django/project_name/')

os.environ['PYTHON_EGG_CACHE'] = '/home/django/.python-eggs'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

What is the problem with this configuration?