Show error message on 500 page in admin instacne.

parent 69ecbe57
......@@ -3,3 +3,7 @@
<p>If you need assistance, you may reference this error as
<strong>{{ }}</strong>.</p>
{% endif %}
{% if exception_message %}
<p>For what it's worth the error message was: {{ exception_message }}</p>
{% endif %}
......@@ -13,6 +13,8 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
import sys
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
......@@ -64,5 +66,11 @@ if settings.SENTRY_DSN:
context = {'request': request}
# on privileged instance show the actual error message to hopefully be useful for the user
if settings.ADMIN:
_, value, _ = sys.exc_info()
context['exception_message'] = value
template_name = '500.html' # You need to create a 500.html template.
return TemplateResponse(request, template_name, context, status=500)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment