diff --git a/hpst/static/img/error_bg.jpg b/hpst/static/img/error_bg.jpg
new file mode 100644
index 0000000..1136b7c
Binary files /dev/null and b/hpst/static/img/error_bg.jpg differ
diff --git a/hpst/templates/404.html b/hpst/templates/404.html
new file mode 100644
index 0000000..3cdb7f7
--- /dev/null
+++ b/hpst/templates/404.html
@@ -0,0 +1,248 @@
+{% load static %}
+
+
+
+
+
+
+
+Sinnes-Tau Fehlerseite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hpst/templates/st_base.html b/hpst/templates/st_base.html
index 3c2b1b6..9136b0f 100644
--- a/hpst/templates/st_base.html
+++ b/hpst/templates/st_base.html
@@ -1,6 +1,4 @@
-{% load static %}
-{% load st_extratags %}
-
+{% load static %}{% load st_extratags %}
Sinnes-Tau.de
@@ -32,7 +30,7 @@
Meine Arbeit
Termine
Kontakt
-
+
diff --git a/hpst/urls.py b/hpst/urls.py
index a85cbc8..b4190c8 100644
--- a/hpst/urls.py
+++ b/hpst/urls.py
@@ -21,7 +21,10 @@ urlpatterns = [
path('success/', views.successView, name='success'),
path(
"favicon.ico",
- RedirectView.as_view(url=staticfiles_storage.url("img/favicon.png")),
+ RedirectView.as_view(url=staticfiles_storage.url("img/favicon.ico")),
),
-
]
+handler404 = 'hpst.views.page_not_found_view'
+handler500 = 'hpst.views.error_view'
+handler403 = 'hpst.views.permission_denied_view'
+handler400 = 'hpst.views.bad_request_view'
diff --git a/hpst/views.py b/hpst/views.py
index 9a4a7df..3404243 100644
--- a/hpst/views.py
+++ b/hpst/views.py
@@ -6,7 +6,9 @@ from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
import datetime
import pytz
-
+#
+from django.conf import settings as conf_settings
+# Model related
from hpst.models import Termin
from hpst.models import Kontakt
from hpst.forms import KontaktForm
@@ -17,6 +19,8 @@ from django.core.mail import BadHeaderError,send_mail
# Hauptseite
def index(request):
termine=Termin.objects.filter(date__gt=timezone.now()).order_by( 'date')
+ #print("Here in view")
+ #print(conf_settings.DEBUG)
context ={
"termine":termine,
"form":KontaktForm(initial={'subject': 'Kontaktformular - Index - sinnestau.de',})
@@ -153,3 +157,35 @@ def contactView(request):
def successView(request):
return HttpResponse('Success! Thank you for your message.')
+
+def page_not_found_view(request, exception):
+ print("pagenotfoundview")
+ r_message = {
+ "titel": "404",
+ "text": "Seite wurde nicht gefunden",
+ "exception":exception
+ }
+ return render(request, "404.html", {'message':r_message})
+
+def error_view(request):
+ r_message = {
+ "titel": "404",
+ "text": "Fehlerseite",
+ }
+ return render(request, "404.html", {'message':r_message})
+
+def bad_request_view(request, exception):
+ r_message = {
+ "titel": "404",
+ "text": "Falscher Aufruf",
+ "exception":exception
+ }
+ return render(request, "404.html", {'message':r_message})
+
+def permission_denied_view(request, exception):
+ r_message = {
+ "titel": "404",
+ "text": "Kein Berechtigung",
+ "exception":exception
+ }
+ return render(request, "404.html", {'message':r_message})
diff --git a/sinnestau/settings.py b/sinnestau/settings.py
index 75ebcf5..25db1b2 100644
--- a/sinnestau/settings.py
+++ b/sinnestau/settings.py
@@ -11,9 +11,10 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
-#Pw etc
+
+#Database & Email PW
from decouple import config
-#from dj_database_url import parse as db_url
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -25,10 +26,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
-# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = config('DEBUG')
-ALLOWED_HOSTS = ['sinnes-tau.de','www.sinnes-tau.de','sinnestau.de','www.sinnes-tau.de','sinnes-tau.kuntner.de','localhost', '127.0.0.1','192.168.178.25','kuntner.de' ]
+SESSION_COOKIE_SECURE=config('SESSIONCOOKIESECURE', default=False, cast=bool)
+
+ALLOWED_HOSTS = ['sinnes-tau.de','www.sinnes-tau.de','sinnestau.de','www.sinnes-tau.de','localhost', '127.0.0.1','192.168.178.25' ]
# Application definition
@@ -89,7 +90,6 @@ DATABASES = {
'charset': 'utf8mb4'
},
}
-
}
@@ -115,9 +115,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
-LANGUAGE_CODE = 'en-us'
+LANGUAGE_CODE = 'de-de'
-TIME_ZONE = 'UTC'
+TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
@@ -129,8 +129,6 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
-#STATIC_URL = '/static/'
-
STATIC_URL = '/st_atic/'
STATIC_ROOT = str(BASE_DIR.joinpath('build/static'))
@@ -146,3 +144,7 @@ EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD');
EMAIL_USE_TLS = True
+#Debugging Options
+DEBUG = config('DEBUG', default=False, cast=bool)
+SESSION_COOKIE_SECURE=config('SESSIONCOOKIESECURE', default=False, cast=bool)
+