Using django 1.11, I have defined a custom 404 handler, by writing in my main URLs.py:
handler404 = 'myApp.views.myError'
The function myError() looks like this:
def myError(request):
#errorMsg=request.error_404_message
return render(request,'404.html')
This function works when I call raise Http404("My msg").
However, when I try to get the message passed by the Http404 call (see commented section in myError), my code crashes:
Server Error (500)
How can I then get the error message? I read a lot of questions about it like this one, but most answers refer to getting the message in the html file and not in a custom python error handler function.
EDIT: The problem is, that I cannot see the debug page, because the error obviously only occurs when myError() is called and this happens only, if debug=False in the settings.
Server Error (500), you should include the full traceback, from your logs/error email.DEBUG=Falseto test the custom 404 page. I would expect to see the traceback in your logs, or the email that is sent to the site admins.