I've been offered on mod_wsgi and apache instead of mod_python. I've all of the parts installed (django, apache, mod_wsgi) but have encounter an issue implementing.

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

My application is known as tred.

Listed here are the appropriate files: httpd-vhosts (incorporated 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 all

  Alias /media /Customers/dmg/Sites/tred/media

    Order allow,deny

    Allow all

  Alias / /Customers/dmg/Sites/tred/

        Order allow,deny

        Allow all

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

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

  WSGIProcessGroup tred


import sys

import os

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')

os.environ['DJANGO_Configurations_MODULE'] = 'tred.settings'

import django.core.handlers.wsgi

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

After I visit http://tred I recieve a directory listing as opposed to the made website. I believe I've adopted the lessons properly but it's clearly not right. So what can I actually do to make this happen?

It really works. I've no clue why, however it does.

For future reference:

It really works because Apache processes alias directives so as, and uses the very first match. It had been always striking Alias /, that will match anything, before WSGIScriptAlias.

In the mod_alias documentation:

First, all Redirects are processed before Aliases are processed, and for that reason a request that suits a Redirect or RedirectMatch won't ever have Aliases applied. Second, the Aliases and Redirects are processed within the order they are within the configuration files, using the first match taking priority.

What goes on should you take away the Alias / directive?

Observe that Alias and WSGIScriptAlias directives don't have exactly the same priority. Thus, they're not going to be processed in file order as written. Rather, all Alias directives get priority over WSGIScriptAlias directives. Thus, it can't have mattered when the Alias for '/' made an appearance after WSGIScriptAlias, it might have taken priority.