My custom templates for 404 page not working in Django

I've been trying to use my custom 404- and 403 pages for my django project and I used code for it that I already used in other projects, but somehow it's not working yet.

This is my function:

def error_404(request, exception):
    return render(request, 'main/errors/404.html', status=404)

And this is where i call the function in the

handler404 = 'main_app.views.error_404'

This is my 404.html:

{% extends "../base.html" %}
{% load static %}
{% load i18n %}

    {% block title %}<h1>404 - {% trans "Page not found" %}</h1>{% endblock %}
    {% block content %}
    <p>The page your looking for could not be found</p>
    {% endblock %}


The pathes should actually be fine, since I used render(template_name=) alot in this project and I just copied it and changed the file name. I also set the DEBUG=False in the

Does anybody have an idea?

As far as I know, and this is the approach I always used, the way to do it is to simply create a 404.html page at root level in the templates folder.

Back to Top