0

Implementing page not found in django and have looked at the documentation 404

I do not get a page not found error as yet what ami doing here

In my code in urls i have done the following,

  url(r'^$', 'site_config.views.pagenotfound')

from django.http import Http404

 def pagenotfound(request):
   return render_to_response('polls/pagenotfound.html', {})
sundar
  • 1,760
  • 12
  • 28
Rajeev
  • 44,985
  • 76
  • 186
  • 285

1 Answers1

3

The way you handle 404 and 500 in django is: by default, in the templates directory, create a 404.html

If you need a custom handler, just add these to urls.py

handler404 = 'views.page_not_found_custom'    
handler500 = 'views.page_error_found_custom'    

design the 404.html page the way you want

karthikr
  • 97,368
  • 26
  • 197
  • 188