A Django reference book ** Create a screen for HTTP status code 403/404/500 ** There is a section, even if you * runserver * or get a 404 error The customized 404 screen was not displayed.
To create a screen for status code 403/404/500
403.html`` 404.html
500.html
.However, even if * runserver * is used as it is This screen is displayed. (Different from the screen I made ...)
At the bottom of the screen
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Is displayed.
Try translating with DeepL.
`This error is displayed because you have set DEBUG = True in your Django config file. If you change this to False, Django will display the standard 404 page. ``
If * DEBUG = True *, it looks like no good.
settings.py
DEBUG = True
Try * runserver *.
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False. I got an error, so I'll fix it.
settings.py
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
Add ʻALLOWED_HOSTS = ['127.0.0.1']` Try * runserver *.
The customized 404 screen was displayed successfully.
404.html
<h1>Page Not Found.</h1>
It was very helpful. Thank you very much.
** Display a customized 404 page in Django ** https://djangobrothers.com/blogs/django_404_page/
Recommended Posts