Remove custom views of 404 and 500 errors
According to Django 1.11 documentation if there are 404.html and 500.html pages in templates root directory then it loads them in case of 404 or 500 errors without any extra code needed. More details in: https://docs.djangoproject.com/en/1.11/ref/views/#error-views Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>merge-requests/428/head
parent
9f159a2ede
commit
494351e2e7
|
@ -12,8 +12,7 @@ from django.contrib.sites.shortcuts import get_current_site
|
|||
from django.core.cache import cache
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import OperationalError
|
||||
from django.http import HttpResponse, HttpResponseNotFound, \
|
||||
HttpResponseServerError, JsonResponse
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
|
@ -55,22 +54,6 @@ def home(request):
|
|||
)
|
||||
|
||||
|
||||
def custom_404(request):
|
||||
"""Custom 404 error handler.
|
||||
|
||||
:returns: 404.html
|
||||
"""
|
||||
return HttpResponseNotFound(render(request, '404.html'))
|
||||
|
||||
|
||||
def custom_500(request):
|
||||
"""Custom 500 error handler.
|
||||
|
||||
:returns: 500.html
|
||||
"""
|
||||
return HttpResponseServerError(render(request, '500.html'))
|
||||
|
||||
|
||||
def robots(request):
|
||||
"""robots.txt handler
|
||||
|
||||
|
|
|
@ -11,10 +11,6 @@ from django.views.static import serve
|
|||
from db.api.urls import API_URLPATTERNS
|
||||
from db.base.urls import BASE_URLPATTERNS
|
||||
|
||||
# pylint: disable=C0103
|
||||
handler404 = 'db.base.views.custom_404'
|
||||
handler500 = 'db.base.views.custom_500'
|
||||
|
||||
urlpatterns = [
|
||||
# Base
|
||||
url(r'^', include(BASE_URLPATTERNS)),
|
||||
|
|
Loading…
Reference in New Issue