Skip to content Skip to sidebar Skip to footer

Django Renders The Template `500.html` Instead Of `404.html`

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=T

Solution 1:

Your error with debug=false may be due to the allowed_hosts setting.

see : Setting DEBUG = False causes 500 Error

It is new in django 1.5

ALLOWED_HOSTS required in production

The new ALLOWED_HOSTS setting validates the request’s Host header and protects against host-poisoning attacks. This setting is now required whenever DEBUG is False, or else django.http.HttpRequest.get_host() will raise SuspiciousOperation. For more details see the full documentation for the new setting.

https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production

Post a Comment for "Django Renders The Template `500.html` Instead Of `404.html`"