1👍
from django.shortcuts import render_to_response
from django.template import RequestContext
def handler404(request):
response = render_to_response('404.html', {},
context_instance=RequestContext(request))
response.status_code = 404
return response
def handler500(request):
response = render_to_response('500.html', {},
context_instance=RequestContext(request))
response.status_code = 500
return response
Add in you views.py the following two views, and just set up the templates 404.html and 500.html with what you want to display.
No custom code needs to be added to urls.py
- [Answered ]-Django rest api not accepting raw data
- [Answered ]-Pie chart highcharts from django query
- [Answered ]-Full Stack Setup with Python
- [Answered ]-Pip is rolling back uninstall of setuptools
Source:stackexchange.com