diff --git a/web_dev/sas_web/sas_web/urls.py b/web_dev/sas_web/sas_web/urls.py index 3992b6d..3e221bb 100644 --- a/web_dev/sas_web/sas_web/urls.py +++ b/web_dev/sas_web/sas_web/urls.py @@ -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 diff --git a/web_dev/sas_web/sas_web/views.py b/web_dev/sas_web/sas_web/views.py new file mode 100644 index 0000000..2059189 --- /dev/null +++ b/web_dev/sas_web/sas_web/views.py @@ -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')) diff --git a/web_dev/sas_web/templates/404.html b/web_dev/sas_web/templates/404.html new file mode 100644 index 0000000..39c4b36 --- /dev/null +++ b/web_dev/sas_web/templates/404.html @@ -0,0 +1,6 @@ +{% extends "public/default.html" %} + +{% block content %} +

Huch? Wo willst du denn hin?

+

Hier geht es zurück zur Startseite.

+{% endblock %}