N
N
Nikolai Getmanov2020-11-03 19:28:11
Django
Nikolai Getmanov, 2020-11-03 19:28:11

How to detect 404 error and others correctly so that the site displays a page from templates or HttpResponse?

While testing the site, I entered the wrong URL and a 404 page came up (with DEBUG = True of course). How to program a site to display a page or HTML code on error (Write valid code in urls.py and views.py)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-11-03
@Kolya_Get

Create a 404.html file and disable debug.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question