Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from django.shortcuts import render
from app.exceptions.custom import NotFound
class ExceptionMiddleware(object):
def process_exception(self, request, exception):
if type(exception) == NotFound:
return render(request, exception.template)
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment