Browse Source

error page

master
corbreedy 4 years ago
parent
commit
6288f78bfd
  1. BIN
      hpst/static/img/error_bg.jpg
  2. 248
      hpst/templates/404.html
  3. 6
      hpst/templates/st_base.html
  4. 7
      hpst/urls.py
  5. 38
      hpst/views.py
  6. 22
      sinnestau/settings.py

BIN
hpst/static/img/error_bg.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

248
hpst/templates/404.html

@ -0,0 +1,248 @@
<!DOCTYPE html>{% load static %}
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="{% static 'Lato2OFLWeb/Lato/latofonts.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'Lato2OFLWeb/Lato/latostyle.css' %}">
<title>Sinnes-Tau Fehlerseite</title>
<style id="" media="all">/* vietnamese */
@font-face {
font-family: 'LatoWebLight';
font-style: normal;
font-weight: 400;
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'LatoWebLight';
font-style: normal;
font-weight: 400;
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'LatoWebLight';
font-style: normal;
font-weight: 400;
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
</style>
<style id="" media="all">/* latin-ext */
@font-face {
font-family: 'LatoWebLight';
font-style: normal;
font-weight: 400;
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'LatoWebLight';
font-style: normal;
font-weight: 400;
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
</style>
<style>
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
padding: 0;
margin: 0;
}
#notfound {
position: relative;
height: 100vh;
}
#notfound .notfound-bg {
position: absolute;
width: 100%;
height: 100%;
background-image: url({% static 'img/error_bg.jpg' %});
background-size: cover;
}
#notfound .notfound-bg:after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.25);
}
#notfound .notfound {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#notfound .notfound:after {
content: '';
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50% , -50%);
-ms-transform: translate(-50% , -50%);
transform: translate(-50% , -50%);
width: 100%;
height: 600px;
background-color: rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0.7) inset;
box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0.7) inset;
z-index: -1;
}
.notfound {
max-width: 600px;
width: 100%;
text-align: center;
padding: 30px;
line-height: 1.4;
}
.notfound .notfound-404 {
position: relative;
height: 200px;
}
.notfound .notfound-404 h1 {
font-family: 'Passion One', cursive;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-size: 220px;
margin: 0px;
color: #222225;
text-transform: uppercase;
}
.notfound h2 {
font-family: 'Muli', sans-serif;
font-size: 26px;
font-weight: 400;
text-transform: uppercase;
color: #222225;
margin-top: 26px;
margin-bottom: 20px;
}
.notfound-search {
position: relative;
padding-right: 120px;
max-width: 420px;
width: 100%;
margin: 30px auto 20px;
}
.notfound-search input {
font-family: 'Muli', sans-serif;
width: 100%;
height: 40px;
padding: 3px 15px;
color: #fff;
font-weight: 400;
font-size: 18px;
background: #222225;
border: none;
}
.notfound-search button {
font-family: 'Muli', sans-serif;
position: absolute;
right: 0px;
top: 0px;
width: 120px;
height: 40px;
text-align: center;
border: none;
background: #ff00b4;
cursor: pointer;
padding: 0;
color: #fff;
font-weight: 400;
font-size: 16px;
text-transform: uppercase;
}
.notfound a {
font-family: 'Muli', sans-serif;
display: inline-block;
font-weight: 400;
text-decoration: none;
background-color: transparent;
color: #222225;
text-transform: uppercase;
font-size: 14px;
}
.notfound-social {
margin-bottom: 15px;
}
.notfound-social>a {
display: inline-block;
height: 40px;
line-height: 40px;
width: 40px;
font-size: 14px;
color: #fff;
background-color: #222225;
margin: 3px;
-webkit-transition: 0.2s all;
transition: 0.2s all;
}
.notfound-social>a:hover {
color: #fff;
background-color: #ff00b4;
}
@media only screen and (max-width: 480px) {
.notfound .notfound-404 {
height: 146px;
}
.notfound .notfound-404 h1 {
font-size: 146px;
}
.notfound h2 {
font-size: 22px;
}
}
</style>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="robots" content="noindex, follow">
</head>
<body>
<div id="notfound">
<div class="notfound-bg"></div>
<div class="notfound">
<div class="notfound-404">
<h1>404</h1>
</div>
<h2>Oops! Diese Seite wurde nicht gefunden</h2>
<a href="{% url 'index' %}">Zurück zur www.sinnes-tau.de Homepage</a>
</div>
</div>
</body>
</html>

6
hpst/templates/st_base.html

@ -1,6 +1,4 @@
{% load static %} <!DOCTYPE html>{% load static %}{% load st_extratags %}
{% load st_extratags %}
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Sinnes-Tau.de</title> <title>Sinnes-Tau.de</title>
@ -32,7 +30,7 @@
<a href="{% url 'index' %}#portfolio" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-th"></i> Meine Arbeit</a> <a href="{% url 'index' %}#portfolio" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-th"></i> Meine Arbeit</a>
<a href="{% url 'index' %}#termine" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-calendar"></i> Termine</a> <a href="{% url 'index' %}#termine" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-calendar"></i> Termine</a>
<a href="{% url 'index' %}#contact" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-envelope"></i> Kontakt</a> <a href="{% url 'index' %}#contact" class="w3-bar-item w3-button w3-hide-small st-hover-bl"><i class="fa fa-envelope"></i> Kontakt</a>
<a href="{% url 'impressum' %}" class="w3-bar-item w3-button w3-hide-small w3-right st-hover-bl" title="Impressum"> <a href="{% url 'impressum' %}" class="w3-bar-item w3-button w3-hide-small w3-right st-hover-bl" title="Impressum / Datenschutz">
<i class="fa fa-info"></i> <i class="fa fa-info"></i>
</a> </a>
</div> </div>

7
hpst/urls.py

@ -21,7 +21,10 @@ urlpatterns = [
path('success/', views.successView, name='success'), path('success/', views.successView, name='success'),
path( path(
"favicon.ico", "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'

38
hpst/views.py

@ -6,7 +6,9 @@ from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
import datetime import datetime
import pytz import pytz
#
from django.conf import settings as conf_settings
# Model related
from hpst.models import Termin from hpst.models import Termin
from hpst.models import Kontakt from hpst.models import Kontakt
from hpst.forms import KontaktForm from hpst.forms import KontaktForm
@ -17,6 +19,8 @@ from django.core.mail import BadHeaderError,send_mail
# Hauptseite # Hauptseite
def index(request): def index(request):
termine=Termin.objects.filter(date__gt=timezone.now()).order_by( 'date') termine=Termin.objects.filter(date__gt=timezone.now()).order_by( 'date')
#print("Here in view")
#print(conf_settings.DEBUG)
context ={ context ={
"termine":termine, "termine":termine,
"form":KontaktForm(initial={'subject': 'Kontaktformular - Index - sinnestau.de',}) "form":KontaktForm(initial={'subject': 'Kontaktformular - Index - sinnestau.de',})
@ -153,3 +157,35 @@ def contactView(request):
def successView(request): def successView(request):
return HttpResponse('Success! Thank you for your message.') 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})

22
sinnestau/settings.py

@ -11,9 +11,10 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
""" """
from pathlib import Path from pathlib import Path
#Pw etc
#Database & Email PW
from decouple import config from decouple import config
#from dj_database_url import parse as db_url
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent 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! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY') 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 # Application definition
@ -89,7 +90,6 @@ DATABASES = {
'charset': 'utf8mb4' 'charset': 'utf8mb4'
}, },
} }
} }
@ -115,9 +115,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/ # 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 USE_I18N = True
@ -129,8 +129,6 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/ # https://docs.djangoproject.com/en/3.2/howto/static-files/
#STATIC_URL = '/static/'
STATIC_URL = '/st_atic/' STATIC_URL = '/st_atic/'
STATIC_ROOT = str(BASE_DIR.joinpath('build/static')) 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_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD');
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
#Debugging Options
DEBUG = config('DEBUG', default=False, cast=bool)
SESSION_COOKIE_SECURE=config('SESSIONCOOKIESECURE', default=False, cast=bool)

Loading…
Cancel
Save