Django Custom Error Views
Prebuilt and customizable error views for Django.
Features
- Responsive design suitable for device sizes from mobile to desktop.
- Supports 400,403,404 and 500 HTTP errors by default.
- Minimal setup required to render the templates.
- Customizable error views through Django settings using custom error handlers.
Installation
pip install django-custom-error-views
INSTALLED_APPS = [
"django_custom_error_views",
]
That's all! Now Django will by default use the templates from the package for 400, 403, 404 and 500 pages. However, if you want to customize the pages by adding a logo, changing text etc. Then you'll need the next section as well.
Customizing Error Pages
To customize the error pages you need to add a custom handler that injects context into the templates. Add the below snippet to your urls.py.
from django.conf import settings
from django_custom_error_views.views import handler400 as ui_handler400
from django_custom_error_views.views import handler403 as ui_handler403
from django_custom_error_views.views import handler404 as ui_handler404
from django_custom_error_views.views import handler500 as ui_handler500
handler400 = "django_custom_error_views.views.handler400"
handler403 = "django_custom_error_views.views.handler403"
handler404 = "django_custom_error_views.views.handler404"
handler500 = "django_custom_error_views.views.handler500"
Add the below snippet to urls.py to debug and visualize the error pages locally. This is optional.
# Optional
if settings.DEBUG:
# This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like.
urlpatterns += [
path(
"400/",
ui_handler400,
kwargs={"exception": Exception("Bad Request!")},
),
path(
"403/",
ui_handler403,
kwargs={"exception": Exception("Permission Denied")},
),
path(
"404/",
ui_handler404,
kwargs={"exception": Exception("Page not Found")},
),
path("500/", ui_handler500),
]
And then you can add the following settings for each page.
DJANGO_CUSTOM_ERROR_VIEWS = {
"company_logo": "/images/icon.png", # Static image or full URL
"400": {
"title": "Custom 400 error.",
"description": "Custom 400 description.",
"extra_content": "400 extras.",
},
"403": {
"title": "Custom 403 Error.",
"description": "Custom 403 description.",
"extra_content": "403 extras.",
"render_exception": True,
},
"404": {
"title": "Custom 404 Error.",
"description": "Custom 404 description.",
"extra_content": "404 extras.",
"render_exception": True,
},
"500": {
"title": "Custom 500 Error.",
"description": "Custom 500 description.",
"extra_content": "500 extras.",
},
}
Each option does the following:
company_logo- Adds a company logo to the top of the page. Either a static ({% static %}) image or a full URL to an imagetitle- Changes the title for the page to a custom one.description- Changes the description for the error to a custom one.extra_content- Adds extra text to the page below the title and description.render_exception- Renders the exception that occurred in the page (only for 403/404 pages), by default it's hidden.
Preview
You can preview the error pages live at:
- 400 HTTP status code
- 403 HTTP status code
- 404 HTTP status code
- 500 HTTP status code - Has the status code 200 only in the demo.
Image preview:
Metadata
Release files for django-custom-error-views 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_custom_error_views-0.3.1.tar.gz | 572.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_custom_error_views-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 685.5 kB
Release files / django_custom_error_views-0.3.1.tar.gz
| Download URL | django_custom_error_views-0.3.1.tar.gz |
|---|---|
| Size | 572.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7367d62255dff84ed515c96c5ddb9bc3fff05e807b31b3d076753a64d0909541
|
|
BLAKE2b-256 checksum How to use checksums |
8f3e0a6fa36a0db327a2bf77b3010a63159109444ef2e68c7cc7895e63b131b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 23, 2026.
Transparency logRelease files / django_custom_error_views-0.3.1-py3-none-any.whl
| Download URL | django_custom_error_views-0.3.1-py3-none-any.whl |
|---|---|
| Size | 112.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
728cebc7b9754803a986f0b765b66bb493b2c7ab8b6b2721eebcff864236d771
|
|
BLAKE2b-256 checksum How to use checksums |
1af859e731aa37b6f770b49dc3bbe1e44e8f5df36ecf98ad409ae67e52b3d825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 23, 2026.
Transparency log