Handling of Python path in wsgi script.
|Reported by:||douglaswrg||Owned by:||nobody|
|Severity:||Keywords:||mod_wsgi path settings|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Following the Django guide from creating a project to configuring mod_wsgi does not lead to a working application. The problem seems to be similar in nature to 12056. One of the comments states that the documentation covers "the common case". As I haven't yet deployed Django in a production with mod_wsgi, maybe I'm missing something. I have deployed it successfully with mod_python in the past, however.
The difference between the documentation and what works in my situation is that both the project directory and its parent directory must be included in the python path. One or the other by itself generates a traceback.
Details of the system this was seen on (Snow Leopard):
Example wsgi script that works:
import os, sys project_space='/projects/' sys.path.insert(0, project_space + 'mytest') sys.path.insert(0, project_space) os.environ['DJANGO_SETTINGS_MODULE'] = 'mytest.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()