Installation

Install the package

pip install sphinx-notfound-page
pip install git+https://github.com/readthedocs/sphinx-notfound-page@master

Once we have the package installed, we have to configure it on our Sphinx documentation. To do this, add this extension to your Sphinx’s extensions in the conf.py file.

# conf.py
extensions = [
     # ... other extensions here
     'notfound.extension',
]

After installing the package and adding the extension in the conf.py file, you can build your documentation again and you will see a new file called 404.html in your documentation’s build output.

Warning

If you open the 404.html file on the browser, you will see that all of the images and css does not display properly. This is because all the URLs are absolute and since the file is being rendered from file:// in the browser, it does not know where to find those resources.

Do not worry too much about this, this is the expected behavior and those resources will appear once the docs are deployed.

Note

This extension requires,

  • Python 2.7+ or 3.x
  • Sphinx 1.5+ or 2.x