Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500.html instead of 404.html

I have basic application with admin panel and direct_to_template home page. When I type url which does not match any from urls I receive 404 error, but when I set DEBUG to false I receive 500.html instead of 404.html. Any idea why?

like image 383
szaman Avatar asked Mar 02 '11 12:03

szaman


2 Answers

Django serves a 500 when a view function fails, which means there must be some non debug specific code breaking.

The only way to tell is see what exception django is logging either via your server logs or the email that django sends to the ADMINS list.

like image 173
Yuji 'Tomita' Tomita Avatar answered Oct 26 '22 22:10

Yuji 'Tomita' Tomita


I would also check TEMPLATE_DIRS path in settings.py as this was the problem in my case. Django raises 404 error, but as it was not able to find 404.html (in the path specified in TEMPLATE_DIRS) so it raised 500 error - template not found (which is either show in the browser when debug is True or server log, when debug=false).

like image 38
Alexey Vassiliev Avatar answered Oct 26 '22 23:10

Alexey Vassiliev