Giving error 500 instead of 404 when debug is False Django

Solution for Giving error 500 instead of 404 when debug is False Django
is Given Below:

myapp/urls.py:

handler404 = 'blog.views.not_found'
handler500 = 'blog.views.server_error'

views:

def not_found(request, exceptions):
   return render(request, 'error/404.html')

def server_error(request):
    return render(request, 'error/500.html')

settings.py:

DEBUG = False

ALLOWED_HOSTS = ['*']
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'staff.context_processors.staff_base',
                'blog.context_processors.cart',
                'blog.context_processors.setting',
            ],
        },
    },
]

WSGI_APPLICATION = 'config.wsgi.application'

404.html:

{% extends 'blog/base.html' %}
{% load static %}

{% block title %}400{% endblock title %}

{% block content %}
    <p>404 Error</p>
{% endblock content %}

in DEBUG = True show me regular 404 error, but in DEBUG = False show me 500 instead of 404
I saw other topics about this issue but i couldn’t find any thing to help me.

in terminal : [02/Aug/2021 15:24:08] "GET /aaaaaaaaaaaa HTTP/1.1" 200 18285

aaaaaaaaaaaa is random url for getting 404