Opened 12 years ago
Closed 12 years ago
#18469 closed Bug (invalid)
Django 1.4 + Apache 2.2.22 + WSGI 3.3 + Apache VirtualDocumentRoot
Reported by: | paulkudla | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 1.4 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In general i have upgraded from django 1.3 to 1.4
apache Config has :
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /usr/home/www/%0/
VirtualScriptAlias "/usr/home/www/%0/cgi-bin"
to allow mapping to virtual web sites.
On django 1.3 i had a html file to redirect into the wsgi file to get to the admin login
# cat index.html <HTML> <HEAD> <META HTTP-EQUIV="refresh" CONTENT="1; url=http://admin.scom.ca/scom_billing/django.wsgi/admin/"> </HEAD> </html> # cat django.wsgi import os import sys sys.path.append('/usr/home/www/admin.scom.ca/') os.environ['DJANGO_SETTINGS_MODULE'] = 'scom_billing.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
the above worked fine.
when migrating to django 1.4 the wsgi wrapper (and i have tried several) is now mixing projects
ie when in the browser and i bring up 2 different projects at the same time i can move around in them and then it will try to call the wrong project name and because that project is not authorized by the browser thus the project session crashes.
this was NOT an issue under 1.3
However when upgrading to 1.4 the password hashes etc were upgraded thus i was forced to stay at 1.4 and run the 2 projects under the manage.py runserver command in the background.
This is obviously a security issue but I had not choice since wsgi keeps mixing the projects
also note the wsgi.py file that comes with the release version crashes as unable to load settings
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testsite.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
Error Returned :
Jun 13 13:15:31 django root: 10.1.0.2 - - [13/Jun/2012:13:15:31 -0400] "GET /testsite/wsgi.py/admin HTTP/1.1" 404 220 Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] mod_wsgi (pid=1209): Exception occurred processing WSGI script '/usr/home/www/testsite.scom.ca/testsite/wsgi.py'. Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] Traceback (most recent call last): Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] self.load_middleware() Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 39, in load_middleware Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] for middleware_path in settings.MIDDLEWARE_CLASSES: Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] self._setup() Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] self._wrapped = Settings(settings_module) Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 95, in __init__ Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) Jun 13 13:16:13 django httpd[1209]: [error] [client 10.1.0.2] ImportError: Could not import settings 'testsite.settings' (Is it on sys.path?): No module named testsite.settings Jun 13 13:16:13 django root: 10.1.0.2 - - [13/Jun/2012:13:16:12 -0400] "GET /testsite/wsgi.py/admin HTTP/1.1" 500 535
Although if you add the path that is what is causing the mixing effect between the projects.
This looks like a problem specific to your setup, not a Django bug. I suspect you need to adjust your WSGIPythonPath.
Please note that trac is not intended for user support. If you need assistence, post to django-users mailing list (http://groups.google.com/group/django-users).