In one of my views I have the code:
raise Http404
When DEBUG=False Django renders the template 500.html instead of the correct 404.html! I can't understand why!
EDIT: When DEBUG=True I get the standard one (by Django)
Page not Found (404)
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
What's more is that in the runserver console I see clearly the 404 code. Instead, when setting DEBUG=False in the console I get a 500!! This is so odd.
EDIT 2: If I place a print statement just before raising Http404 I see the message when DEBUG=True but not when it is False!
EDIT 3: I can confirm that when DEBUG=False the statement raise Http404 is never reached. How can it be possible??
Update
Actually with DEBUG=False at every URL I get a 500. While with DEBUG=True this does not happen. How can it possibly be?? It should run the same. I'm starting to think it is a Django bug.