Orange County Lettings - Error Pages¶
This page documents the custom error pages and how they are handled.
Overview¶
Custom handlers are enabled when
DEBUG=FalseConfigured in
oc_lettings_site/urls.py:handler404 = "oc_lettings_site.views.custom_404"handler500 = "oc_lettings_site.views.custom_500"
Handlers¶
custom_404¶
Logs a warning with request path and referer
Sends a non-exception message to Sentry in production (if
SENTRY_DSNset)Renders
templates/404.htmlwith HTTP 404 status
custom_500¶
Logs an error with request path
Renders
templates/500.htmlwith HTTP 500 status
Templates¶
Global templates are located under
templates/templates/404.html: shown when a page is not foundtemplates/500.html: shown for server errors
Local testing tips¶
To preview
404.htmllocally: setDEBUG=Falseand request a missing routeTo trigger
500.htmllocally: setDEBUG=Falseand visit/sentry-debug/(raises an error)Ensure environment variable
ENV_MODE=prodif you want to mimic production behavior
Orange County Lettings