Add custom error handlers
This commit is contained in:
parent
ee02fab3a3
commit
17a71ddfb6
8
basics/templates/basics/badrequest.html
Normal file
8
basics/templates/basics/badrequest.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends 'front_base.html' %}
|
||||
|
||||
{% block title %} - Bad Request{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Your browser sent an incorrect request.
|
||||
{% endblock %}
|
||||
|
8
basics/templates/basics/forbidden.html
Normal file
8
basics/templates/basics/forbidden.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends 'front_base.html' %}
|
||||
|
||||
{% block title %} - Forbidden{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
You are not allowed to access the requested resource.
|
||||
{% endblock %}
|
||||
|
8
basics/templates/basics/notfound.html
Normal file
8
basics/templates/basics/notfound.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends 'front_base.html' %}
|
||||
|
||||
{% block title %} - Not Found{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
The requested resource cannot be found.
|
||||
{% endblock %}
|
||||
|
8
basics/templates/basics/serverror.html
Normal file
8
basics/templates/basics/serverror.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends 'front_base.html' %}
|
||||
|
||||
{% block title %} - Internal Server Error{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
There was an error processing your request. The admins have been notified.
|
||||
{% endblock %}
|
||||
|
@ -13,3 +13,15 @@ def about(request):
|
||||
|
||||
def disclaimer(request):
|
||||
return render(request, 'basics/disclaimer.html', {})
|
||||
|
||||
def notfound(request):
|
||||
return render(request, 'basics/notfound.html', {})
|
||||
|
||||
def serverror(request):
|
||||
return render(request, 'basics/serverror.html', {})
|
||||
|
||||
def forbidden(request):
|
||||
return render(request, 'basics/forbidden.html', {})
|
||||
|
||||
def badrequest(request):
|
||||
return render(request, 'basics/badrequest.html', {})
|
||||
|
@ -3,6 +3,11 @@ from django.conf.urls import patterns, include, url
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
handler404 = 'basics.views.notfound'
|
||||
handler500 = 'basics.views.serverror'
|
||||
handler403 = 'basics.views.forbidden'
|
||||
handler400 = 'basics.views.badrequest'
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Examples:
|
||||
url(r'^$', 'blog.views.mainpage', name='home'),
|
||||
|
Loading…
Reference in New Issue
Block a user