Created
November 5, 2020 04:21
-
-
Save yujinyuz/9815da8f1ec1a723718d3091b6ede856 to your computer and use it in GitHub Desktop.
Allow debugging in production for superusers
This file contains 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
# core/middleware.py | |
import sys | |
from django.views.debug import technical_500_response | |
class UserBasedExceptionMiddleware: | |
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