The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Add custom error handlers

master
Gergely Polonkai 9 years ago
parent ee02fab3a3
commit 17a71ddfb6
  1. 8
      basics/templates/basics/badrequest.html
  2. 8
      basics/templates/basics/forbidden.html
  3. 8
      basics/templates/basics/notfound.html
  4. 8
      basics/templates/basics/serverror.html
  5. 12
      basics/views.py
  6. 5
      gergelypolonkaiweb/urls.py

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

@ -0,0 +1,8 @@
{% extends 'front_base.html' %}
{% block title %} - Forbidden{% endblock %}
{% block content %}
You are not allowed to access the requested resource.
{% endblock %}

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

@ -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…
Cancel
Save