Opened 14 years ago
Closed 14 years ago
#15526 closed (duplicate)
Handling of Python path in wsgi script.
Reported by: | douglaswrg | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.2 |
Severity: | Keywords: | mod_wsgi path settings | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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):
Apache 2.2.15
mod_wsgi 3.3
Python 2.6.1
Django 1.2.5
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()
I think it is a duplicate of #15058.