python - Django MessageMiddleware failure -


i'm using django 1.5.1 in virtualenv, python 2.7 on os x 10.8.4. changed debug = true debug = false in django settings , got error:

traceback (most recent call last):   file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run     self.result = application(self.environ, self.start_response)   file "/users/kilroy/.virtualenvs/project_name/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 255, in __call__     response = self.get_response(request)   file "/users/kilroy/.virtualenvs/project_name/lib/python2.7/site-packages/django/core/handlers/base.py", line 178, in get_response     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())   file "/users/kilroy/.virtualenvs/project_name/lib/python2.7/site-packages/django/core/handlers/base.py", line 224, in handle_uncaught_exception     return callback(request, **param_dict)   file "/users/kilroy/sites/python/project_name/apps/common/views.py", line 436, in handler_500     messages.error(request, '500 - internal server error.')   file "/users/kilroy/.virtualenvs/project_name/lib/python2.7/site-packages/django/contrib/messages/api.py", line 102, in error     fail_silently=fail_silently)   file "/users/kilroy/.virtualenvs/project_name/lib/python2.7/site-packages/django/contrib/messages/api.py", line 22, in add_message     raise messagefailure('you cannot add messages without installing ' messagefailure: cannot add messages without installing django.contrib.messages.middleware.messagemiddleware 

i'm using different settings file development , production, , on development machine set environment variable in /users/kilroy/.virtualenvs/project_name/bin/postactivate file this:

export django_settings_module=project_name.settings.local 

my base.py file looks https://dpaste.de/avxml/, , local.py settings https://dpaste.de/z0pxv/.

why happening when want disable debugging , how can trace why problem occurs in first place?

i had same stack trace when set debug false when using development server. in case related allowed_hosts setting / check django. symptoms confusing because suspiciousoperation exception being raised caused error.

if had allowed_hosts = ['localhost'] in settings file , http://localhost:8000 browser address well. however, if use ip address http://127.0.0.1:8000/ directly got error.


Comments