Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling improvements #39

Open
ebridges opened this issue May 26, 2019 · 0 comments
Open

Error handling improvements #39

ebridges opened this issue May 26, 2019 · 0 comments
Labels
enhancement New feature or request minor

Comments

@ebridges
Copy link
Owner

Original report by Edward Bridges (Bitbucket: ebridges, GitHub: ebridges).


In project/base/urls.py:

# handler400 – See django.conf.urls.handler400.
# handler403 – See django.conf.urls.handler403.
# handler404 – See django.conf.urls.handler404.
# handler500 – See django.conf.urls.handler500.

# e.g.:
# handler400 = 'mysite.views.my_custom_bad_request_view'
# handler403 = 'mysite.views.my_custom_permission_denied_view'
# handler404 = 'mysite.views.my_custom_page_not_found_view'
# handler500 = 'mysite.views.my_custom_error_view'

In project/base/views/errors.py

# CSRF_FAILURE_VIEW
# Default: 'django.views.csrf.csrf_failure'
#
# A dotted path to the view function to be used when an incoming request is rejected by the CSRF protection. The
# function should have this signature:
#
#     def csrf_failure(request, reason=""):
#       ...
#
# where reason is a short message (intended for developers or logging, not for end users) indicating the reason the
# request was rejected. It should return an `HttpResponseForbidden`.
#
# `django.views.csrf.csrf_failure()` accepts an additional `template_name` parameter that defaults to '403_csrf.html'.
# If a template with that name exists, it will be used to render the page.
@ebridges ebridges added major enhancement New feature or request minor and removed major labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

No branches or pull requests

1 participant