Add custom error handlers

This commit is contained in:
Gergely Polonkai 2014-06-14 17:09:10 +00:00
parent ee02fab3a3
commit 17a71ddfb6
6 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,8 @@
{% extends 'front_base.html' %}
{% block title %} - Bad Request{% endblock %}
{% block content %}
Your browser sent an incorrect request.
{% endblock %}

View 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 %}

View File

@ -0,0 +1,8 @@
{% extends 'front_base.html' %}
{% block title %} - Not Found{% endblock %}
{% block content %}
The requested resource cannot be found.
{% endblock %}

View 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 %}

View File

@ -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', {})

View File

@ -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'),