When Django can't find a regex matching the requested URL, or when an exception is raised, Django will invoke an error-handling view. The views to use for these cases are specified by four variables. The variables are:
handler404
handler500
handler403
handler400
Their default values should suffice for most projects, but further customization is possible by assigning values to them. Such values can be set in your root URLconf. Setting these variables in any other URLconf will have no effect. Values must be callables, or strings representing the full Python import path to the view that should be called to handle the error condition at hand.