5👍
Try moving your middleware to the bottom of the MIDDLEWARE_CLASSES
stack so it’s the first piece of middleware that gets to handle the request on its way out to the client. I believe Django has already caught your exception and rendered its own error 500 page if you put it last.
Source:stackexchange.com