O'Reilly logo

Learning Django Web Development by Ratan Kumar, Sanjeev Jaiswal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting error pages

With the debug mode disabled, you should create templates for the error pages, particularly these two files:

  • 404.html: This template will be displayed when the requested URL does not exist; in other words, when a page is not found, such as an uncaught exception.

    Create the two files with whatever content you like. You can, for example, put a "Page not found" message in the 404.html template or a search form.

  • 500.html: This template will be displayed when an internal server error occurs.

It is recommended that you give these templates a consistent look by deriving them from the base template of your site. Put the templates at the top in your templates folder and Django will automatically use them.

This should cover the configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required