![How to make a default 404 page in Flask](/img/articleImages/default-404-page-flask-python.jpg)
How to make a default 404 page in Flask
There is many benefits in having a default 404 page. You keep your visitors on the website and is able display a link so they can do something else on your website, beside having to deal with the standard dead end 404 page that the browser generates.
To add a default 404 page in flask with Python, you need to create an errorhandler where your routes is and give it the error code as parameter. In this case it is 404.
Finally you need to create the actual 404 page that you want to return. So inside your templates folder, create a new file called 404.html
To test it, just run your application and then type a url that does not exist on your website. You should then get the 404.html in return.