I would like to show an 404 error if there's no proper entry in
I read Writing your first Django app but i don't understood how to create a general error - not only for an app.
So i tried this:
TEMPLATE_DIRS = /var/www/first/templates
from django.http import Http404
After all i still get a 500 error if i call an unknown url.
Django uses the urls.py file to evaluate all the url patterns by order. If you want it to go to a certain page after it evaluated all the regex patterns and found no match, just add something like this as the last item in the
defaultview possibly being that 404 page.
django.views.defaults.page_not_found is a built-in django view that renders whatever's in
It works with following in
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ..., url(r'^admin/', include(admin.site.urls)), ..., )