I think I’ve tried everything I found on the internet in the past 2 days and I can’t find the right setting to display the error pages.

My views are

...
from django.shortcuts import render, render_to_response
from django.template import RequestContext

def handler404(request, exception, template_name="404.html"):
    response = render_to_response("404.html")
    response.status_code = 404
    return response

def handler500(request, exception, template_name="500.html"):
    response = render_to_response("500.html")
    response.status_code = 500
    return response

Settings.py

DEBUG = (os.environ.get('DEBUG_VALUE') == 'False')

ALLOWED_HOSTS = ['*', '127.0.0.1']

Main urls.py

handler404 = 'portfolio.views.handler500'
handler500 = 'portfolio.views.handler500'

I use Python 3.7 and Django 2.2

Anyone know this?

This post is also available on DEV.