Browse Source

custom 404 page

master
erichhasl 8 years ago
parent
commit
da62902950
3 changed files with 17 additions and 1 deletions
  1. +5
    -1
      web_dev/sas_web/sas_web/urls.py
  2. +6
    -0
      web_dev/sas_web/sas_web/views.py
  3. +6
    -0
      web_dev/sas_web/templates/404.html

+ 5
- 1
web_dev/sas_web/sas_web/urls.py View File

@@ -18,6 +18,8 @@ from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings

from .views import error_404

urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += [
@@ -28,5 +30,7 @@ urlpatterns += [
namespace='datenbank')),
url(r'^admin/', include(admin.site.urls)),
url(r'^captcha/', include('captcha.urls')),
url(r'^', include('startpage.urls', namespace='startpage', app_name='startpage'))
url(r'^', include('startpage.urls', namespace='startpage', app_name='startpage')),
]

handler404 = error_404

+ 6
- 0
web_dev/sas_web/sas_web/views.py View File

@@ -0,0 +1,6 @@
from django.template.loader import render_to_string
from django.http import HttpResponseNotFound


def error_404(request):
return HttpResponseNotFound(render_to_string('404.html'))

+ 6
- 0
web_dev/sas_web/templates/404.html View File

@@ -0,0 +1,6 @@
{% extends "public/default.html" %}

{% block content %}
<h1>Huch? Wo willst du denn hin?</h1>
<p><a href="{% url "startpage:index" %}">Hier</a> geht es zurück zur Startseite.</p>
{% endblock %}

Loading…
Cancel
Save