I'm implementing a Django web page and that i love the Django Debug 404 page and and also the Django page when there's a python error. However, these aren't right for a web page that's going on the internet. And So I make a custom 404 page. However, for me personally, and my Ip, I wish to have the Django Debug pages show up. Can there be anyway to get this done basically set Debug to false?
You are able to define your personal handler-view for 404s, by setting handler404 inside your urlconf. The default handler404 is
django.views.defaults.page_not_found, which essentially just renders the
Should you put this inside your urlconf, it'll show the "technical" 404 response (the excellent yellow page) for any certain IP, and employ Django's default 404-production view for other Insolvency practitioners:
import sys from django.views.debug import technical_404_response from django.views.defaults import page_not_found def handler404(request): if request.META['REMOTE_ADDR'] == 'YOUR_IP_ADDRESS': exc_type, exc_value, tb = sys.exc_info() return technical_404_response(request, exc_value) else: return page_not_found(request)
I'd counsel you to setup proper logging for you personally 404 errors. Django can e-mail or log 404s and exceptions for you personally that occurs inside your production atmosphere for rules that you could specify.