DEV Community

Discussion on: [SOLVED]Why doesn't my Django app display the 404 page even when Debug = False?

 
pedromendes96 profile image
Pedro Mendes

from django.views.default import page_not_found

def handler_404(request, exception):
return page_not_found(request, exception, template_name="errors/404.html")

Thread Thread
 
highcenburg profile image
Vicente G. Reyes

Thank you. There's a little typo on the django.views.default. It should be django.views.defaults.

Anyway, I think it worked. The only question I think I have is if the template should be inside errors or if its ok if the template is inside the template folder together with the other html files.

Thread Thread
 
pedromendes96 profile image
Pedro Mendes

No, that example is from an older project. That path to the template could be any path you want.

Thread Thread
 
highcenburg profile image
Vicente G. Reyes

Got it. Thank you.