- Python 3.8+ supported.
- Django 3.2+ supported.
- Install from pip:
pip install django-errors- modify
settings.pyby adding the app toINSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django_errors",
# ...
]- Finally, modify your project
urls.pywith handlers for all errors:
# ...other imports...
from django_errors import views as errors_views
urlpatterns = [
# ...other urls...
]
handler400 = errors_views.custom_400
""" Handle 400 error """
handler403 = errors_views.custom_403
""" Handle 403 error """
handler404 = errors_views.custom_404
""" Handle 404 error """
handler500 = errors_views.custom_500
""" Handle 500 error """git clone --depth=50 --branch=django-errors https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserverNow browser the app @ http://127.0.0.1:8000