Django Custom 404 Page

Simple customization for 404 not found page. Django 3.0, official docs here.

Default Django 404 page
Custom 404 Page

Step 1: Preparation, Create Django Project, Initial Migration
install virtualenv: pip install virtualenv
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Migrate: python migrate

Step 2. Create Django Apps
Create apps: python startapp myapp
Add myapp to INSTALLED_APPS in myproject/

Step 3. Preparing Templates Folder
Add folder templates in myapp

Register myapp/templates in myproject/


Set DEBUG=False and ALLOWED_HOSTS to ‘’ in myproject/

Step 5. Add 404.html file in myapp/templates folder


Step 6. Update myapp/


Step 7. Update myproject/
handler404 will override the default 404 page.


Step 8. Run and Try it in browser

python runserver

try to access page that not available in app, such as



Software Engineer, Indonesia

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store