Невозможно получить страницу 404 при вводе недействительного url
проект Url.py
handler404 = 'patient.views.handler404'
Patient views.py
def handler404(request,exception): return render(request, 'error/404.html')
404.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404ERROR</title>
<link href="{% static 'css/404style.css' %}" rel="stylesheet">
</head>
<body>
<h2>Page Not Found</h2>
</body>
</html>
А также отключите debug=False но все равно выдает ошибку сервера (500)
Я не уверен насчет handler404(request,exception)
.
Я вижу в Django:
django.views.default.page_not_found(request,exception, template=default_404_template).
в вашем случае попробуйте:
def handler404(request, *args, **kwargs):
return render(request, 'error/404.html')
Но я не знаю ваш стек ошибок 500.
Если это TemplateNotFound
исключение, существует ли 'error/404.html'?