Python – Setup django with WSGI and apache

apachedjangomod-wsgipython

I have been sold on mod_wsgi and apache rather than mod_python.
I have all the parts installed (django, apache, mod_wsgi) but have run into a problem deploying.

I am on osx 10.5 with apache 2.2 and django 1.0b2, mod_wsgi-2.3

My application is called tred.

Here are the relevant files:
httpd-vhosts (included in httpd-conf)

NameVirtualHost tred:80



  ServerName tred

  Alias /admin_media /usr/lib/python2.5/site-packages/django/contrib/admin/media

  
    Order allow,deny
    Allow from all
  

  Alias /media /Users/dmg/Sites/tred/media

  
    Order allow,deny
    Allow from all
  

  Alias / /Users/dmg/Sites/tred/

  
        Order allow,deny
        Allow from all
    

  WSGIScriptAlias / /Users/dmg/Sites/tred/mod_wsgi-handler.wsgi

  WSGIDaemonProcess tred user=dmg group=staff processes=1 threads=10
  WSGIProcessGroup tred


mod_wsgi-handle.wsgi

import sys
import os

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'tred.settings'

import django.core.handlers.wsgi

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

When I go to http://tred I get a directory listing rather than the rendered website. I think I have followed the tutorials correctly but it is obviously not right. What can I do to make this work?

Best Answer

What happens if you remove the Alias / directive?