CARVIEW |
Select Language
HTTP/2 200
date: Fri, 10 Oct 2025 18:31:53 GMT
content-type: text/html; charset=utf-8
cross-origin-opener-policy: same-origin
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
referrer-policy: same-origin
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=6o9PiOG3Yfkz9%2BmWf3FY1%2BucDwVJ4%2BdIPfD6kfZJLL4%3D\u0026sid=af571f24-03ee-46d1-9f90-ab9030c2c74c\u0026ts=1760121113"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=6o9PiOG3Yfkz9%2BmWf3FY1%2BucDwVJ4%2BdIPfD6kfZJLL4%3D&sid=af571f24-03ee-46d1-9f90-ab9030c2c74c&ts=1760121113"
server: cloudflare
strict-transport-security: max-age=15552000; includeSubDomains; preload
vary: Cookie
via: 1.1 heroku-router
x-content-type-options: nosniff
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: csrftoken=L9uXx7FxdWHflou95qUjku3pYTbcz4ru; SameSite=Lax; Path=/; Max-Age=31449600; Expires=Fri, 09 Oct 2026 18:31:53 GMT
cf-ray: 98c8327c9e2c84b6-BOM
alt-svc: h3=":443"; ma=86400
djangosnippets: Super User Conditional Page Exception Reporting
Super User Conditional Page Exception Reporting
Step 1 Save somewhere in your project directory
Step 2 Add to your settings.py
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'utils.debug.UserBasedExceptionMiddleware',
)
Normal users will get your 500.html when debug = False, but If you are logged in as a super user then you get to see the stack trace in all its glory.
1 2 3 4 5 6 7 | from django.views.debug import technical_500_response
import sys
class UserBasedExceptionMiddleware(object):
def process_exception(self, request, exception):
if request.user.is_superuser:
return technical_500_response(request, *sys.exc_info())
|
More like this
- Add Toggle Switch Widget to Django Forms by OgliariNatan 1 month ago
- get_object_or_none by azwdevops 4 months, 3 weeks ago
- Mask sensitive data from logger by agusmakmun 6 months, 3 weeks ago
- Template tag - list punctuation for a list of items by shapiromatron 1 year, 8 months ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 1 year, 9 months ago
Comments
Please login first before commenting.