The configuration example both on the Django website and on the mod_wsgi site itself shows a configuration where you set up the wsgi script to refer to an absolute path. That seemed like unnecessary configuration to be done every time I’m going to setup a Django site. Instead I created one where the path names are relative to the file instead. In my case the file resides under /etc/myproject/mydjangoproject/apache/django.wsgi, so I ended up with this:
import os
import sys
""" For safetys sake we don't want to import just 'settings' so we add the
parent dir for safer a safer import."""
paths = [
os.path.normpath( os.path.join( os.path.dirname(__file__), "../" ) ),
os.path.normpath( os.path.join( os.path.dirname(__file__), "../../" ) )
]
sys.path.extend( paths )
os.environ['DJANGO_SETTINGS_MODULE'] = 'deals.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()