Http404

Based on the HTTP standards, the 404 error is supposed to be for Page Not Found, not a generic error page

Settings.py

DEBUG = False
ALLOWED_HOSTS = ['*']  # Don't Use ['*'] For Production
# ALLOWED_HOSTS = ['localhost', '127.0.0.1']

404.html

You can create an HTML template named 404.html and place it in the top level of your template tree

Usage

from django.http import Http404

def xxx(request):
    # Some Code
    raise Http404('xxx')

References

[1] [email protected], The Http404 exception

[2] [email protected], The 404 (page not found) view

results matching ""

    No results matching ""