5.5 Generating 404 Errors for Invalid Queries

As things stand, we can use the command line to start our development server (Example 5.11) and see the fruits of our labor.

Example 5.11: Shell Code

$ ./manage.py runserver

If you navigate to the address of a valid Tag, you will be greeted by a simple HTML page built from our template. For example, http://127.0.0.1:8000/tag/django/ will display a simple page about our Django tag. However, what happens if you browse to a URL built with an invalid tag slug, such as http://127.0.0.1:8000/tag/nonexistent/?

You’ll be greeted by a page of Django debug information, as shown in Figure 5.4.

Image

Figure 5.4: ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.