In your templates directory create templates custom404.html
and custom500.html
Add this to your urls.py
at the bottom if application specific or in urls.py
where you include urls to other apps
handler404 = 'custom_views.handler404'
handler500 = 'custom_views.handler500'
And define views like this in custom_views
file in root once
from django.shortcuts import render_to_response
def handler404(request, *args, **kwargs):
response = render_to_response('custom404.html', context = {})
response.status_code = 404
return response
def handler500(request, *args, **kwargs):
response = render_to_response('custom500.html', context={})
response.status_code = 500
return response
This will route your 404,500 url to the template views there your are building a template and rendering it