Created
October 26, 2017 21:08
-
-
Save jacobpledger/656a4c112ef5890d2de347903bdf00ab to your computer and use it in GitHub Desktop.
Django Middleware to Allow Debug for Superusers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy this into your project and add the class to | |
# your MIDDLEWARE_CLASSES in your settings | |
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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment