#24360 closed Bug (fixed)
when LocaleMiddleware activated, no error page with traceback and error message in logger
Reported by: | mishust | Owned by: | |
---|---|---|---|
Component: | Core (Other) | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Steps to reproduce:
- include in MIDDLEWARE_CLASSES
'django.middleware.locale.LocaleMiddleware',
- Make error in code (for example addind 'f' symbol)
urlpatterns = patterns(,
f
url(r'admin/', include(admin.site.urls)),
- Open root page http://mysite/
Result: "A server error occurred. Please contact the administrator." HTML page
and Traceback on concole output
Expected result: with Debug=True expecting to see HTML error page with Traceback and detailed info.
Also, error message dont appear in python logger - in files, not send to ADMIN emails.
Change History (10)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 10 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:5 by , 10 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:6 by , 10 years ago
Has patch: | set |
---|
The problem appears when a middleware fails in its __init__
method. In the LocaleMiddleware
use case, it can easily be workarounded by transforming is_language_prefix_patterns_used
into a cached property, like this:
https://github.com/django/django/pull/4224
comment:7 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:8 by , 10 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:9 by , 10 years ago
Just wanted to add to this ticket for those stuck with django.db.utils.OperationalError: SSL SYSCALL errors. Using the fix in master (which I assume will be in 1.7.6) fixes the issue.
00:50:04.391 2015-03-06 06:50:04.020323+00:00 app web.1 - - Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__ self.load_middleware() File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 46, in load_middleware mw_instance = mw_class() File "/app/.heroku/python/lib/python2.7/site-packages/django/middleware/locale.py", line 23, in __init__ for url_pattern in get_resolver(None).url_patterns: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py", line 372, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py", line 366, in urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "./verde/urls.py", line 22, in <module> (r'^verdeadmin/', include(admin.site.urls)), File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 262, in urls return self.get_urls(), self.app_name, self.name File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 246, in get_urls url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls)) File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/options.py", line 598, in urls return self.get_urls() File "/app/.heroku/python/lib/python2.7/site-packages/cms/admin/pageadmin.py", line 145, in get_urls url_patterns += super(PageAdmin, self).get_urls() File "/app/.heroku/python/lib/python2.7/site-packages/cms/admin/placeholderadmin.py", line 131, in get_urls from cms.urls import SLUG_REGEXP File "/app/.heroku/python/lib/python2.7/site-packages/cms/urls.py", line 20, in <module> urlpatterns = get_app_patterns() File "/app/.heroku/python/lib/python2.7/site-packages/cms/appresolver.py", line 191, in get_app_patterns current_site = Site.objects.get_current() File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/sites/models.py", line 54, in get_current current_site = self.get(pk=sid) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 351, in get num = len(clone) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 122, in __len__ self._fetch_all() File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 966, in _fetch_all self._result_cache = list(self.iterator()) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 265, in iterator for row in compiler.results_iter(): File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter for rows in self.execute_sql(MULTI): File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql cursor.execute(sql, params) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) django.db.utils.OperationalError: SSL SYSCALL error: EOF detected Exception
comment:10 by , 10 years ago
Note that this has only been committed to the master branch (targeting 1.9).
Same problem report: http://grokbase.com/t/gg/django-users/148bk4yant/adding-localemiddleware-does-not-show-pretty-error-pages