diff --git a/Caddyfile b/Caddyfile index bec974e..cb4a9aa 100644 --- a/Caddyfile +++ b/Caddyfile @@ -22,7 +22,8 @@ boday-it.ch { # 5. Sicherheits-Header setzen (Optional, aber dringend empfohlen) header { # Verhindert, dass die Seite in einem fremden Frame geladen wird (Schutz vor Clickjacking) - X-Frame-Options "DENY" + #X-Frame-Options "DENY" + X-Frame-Options "SAMEORIGIN" # Aktiviert den Cross-Site-Scripting-Schutz im Browser X-XSS-Protection "1; mode=block" # Verhindert das automatische Erraten des Inhaltstyps (MIME-Sniffing) @@ -31,3 +32,8 @@ boday-it.ch { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" } } + +# 2. Die www-Subdomain (Automatische Zertifizierung + Weiterleitung) +www.boday-it.ch { + redir https://boday-it.ch{uri} permanent +} diff --git a/Dockerfile b/Dockerfile index 64e7738..96f76f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,25 @@ -# 1. Verwende das offizielle Python 3.8.18 Image auf minimaler Debian-Basis -FROM python:3.8.18-slim +# 1. Das normale, vollständige Python-Image nutzen +FROM python:3.8.18 # 2. Setze Umgebungsvariablen für Python -# Verhindert, dass Python .pyc-Dateien schreibt ENV PYTHONDONTWRITEBYTECODE=1 -# Verhindert, dass Python Ausgaben puffert (wichtig für Echtzeit-Docker-Logs) ENV PYTHONUNBUFFERED=1 # 3. Setze das Arbeitsverzeichnis im Container WORKDIR /code # 4. Installiere System-Abhängigkeiten -# gcc und libpq-dev werden für PostgreSQL (psycopg2) und einige Python-Pakete benötigt +# 'gcc' wird hier nicht mehr benötigt, da es im Image schon enthalten ist RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc \ libpq-dev \ && rm -rf /var/lib/apt/lists/* # 5. Installiere die Python-Abhängigkeiten -# Zuerst requirements.txt kopieren, um den Docker-Cache optimal zu nutzen COPY requirements.txt /code/ RUN pip install --upgrade pip && pip install -r requirements.txt # 6. Kopiere den restlichen Django-Quellcode in den Container COPY . /code/ -# 7. Erstelle die Ordner für statische Medien (wichtig für die Caddy-Anbindung) +# 7. Erstelle die Ordner für statische Medien RUN mkdir -p /code/staticfiles /code/mediafiles diff --git a/Dockerfile.old b/Dockerfile.old new file mode 100644 index 0000000..3f434d5 --- /dev/null +++ b/Dockerfile.old @@ -0,0 +1,39 @@ +# 1. Verwende das offizielle Python 3.8.18 Image auf minimaler Debian-Basis +FROM python:3.8.18-slim + +# 2. Setze Umgebungsvariablen für Python +# Verhindert, dass Python .pyc-Dateien schreibt +ENV PYTHONDONTWRITEBYTECODE=1 +# Verhindert, dass Python Ausgaben puffert (wichtig für Echtzeit-Docker-Logs) +ENV PYTHONUNBUFFERED=1 + +# 3. Setze das Arbeitsverzeichnis im Container +WORKDIR /code + +# 4. Installiere System-Abhängigkeiten +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list && \ + sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list && \ + sed -i '/stretch-updates/d' /etc/apt/sources.list && \ + apt-get update && apt-get install -y --no-install-recommends \ + gcc \ + libpq-dev \ + && rm -rf /var/lib/apt/lists/* + + +# 4. Installiere System-Abhängigkeiten +# gcc und libpq-dev werden für PostgreSQL (psycopg2) und einige Python-Pakete benötigt +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc \ + libpq-dev \ + && rm -rf /var/lib/apt/lists/* + +# 5. Installiere die Python-Abhängigkeiten +# Zuerst requirements.txt kopieren, um den Docker-Cache optimal zu nutzen +COPY requirements.txt /code/ +RUN pip install --upgrade pip && pip install -r requirements.txt + +# 6. Kopiere den restlichen Django-Quellcode in den Container +COPY . /code/ + +# 7. Erstelle die Ordner für statische Medien (wichtig für die Caddy-Anbindung) +RUN mkdir -p /code/staticfiles /code/mediafiles diff --git a/boday_it/settings.py b/boday_it/settings.py index bdc0012..f4f43b2 100644 --- a/boday_it/settings.py +++ b/boday_it/settings.py @@ -60,12 +60,12 @@ USE_TZ = True STATIC_URL = '/static/' MEDIA_URL = '/media/' -MEDIA_ROOT = os.path.join(DATA_DIR, 'media') -#STATIC_ROOT = os.path.join(DATA_DIR, 'static') -STATIC_ROOT = "/var/www/boday_it/static" +MEDIA_ROOT = os.path.join(DATA_DIR, 'mediafiles') +STATIC_ROOT = os.path.join(DATA_DIR, 'staticfiles') +#STATIC_ROOT = "/static" STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'boday_it', 'static'), + os.path.join(BASE_DIR, 'boday_it/static'), ) SITE_ID = 1 @@ -214,3 +214,9 @@ THUMBNAIL_PROCESSORS = ( 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters' ) + +# 1. Sagt Django, dass die Verbindung über Caddy (HTTPS) sicher ist +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + +# 2. Erlaubt Django CMS das Laden von internen Bearbeitungs-Iframes +X_FRAME_OPTIONS = 'SAMEORIGIN' diff --git a/boday_it/static/css/custom_overwrites.css b/boday_it/static/css/custom_overwrites.css index ec4669d..f073e01 100644 --- a/boday_it/static/css/custom_overwrites.css +++ b/boday_it/static/css/custom_overwrites.css @@ -1,3 +1,11 @@ +body { + font-family: Roboto, "Helvetica Neue", Helvetica, sans-serif; + font-size: 18px; + line-height: 1.6; + color: #666; + font-weight: 500; /* Macht die Linien dicker */ +} + body#page-top { display: flex; flex-direction: column; @@ -125,4 +133,4 @@ footer.footer li.back-top--hidden { span.caret.caret_up { transform: rotate(180deg); -} \ No newline at end of file +} diff --git a/custom_overwrites.css b/custom_overwrites.css new file mode 100644 index 0000000..0d61d78 --- /dev/null +++ b/custom_overwrites.css @@ -0,0 +1,128 @@ +body#page-top { + display: flex; + flex-direction: column; + min-height: 100vh; +} + +body>div.container { + flex: 1; +} + +a { + color: rgb(28, 146, 204); +} + +.navbar-main .nav>.active>a>span, .navbar-main .nav>li:hover>a>span { + border-color: rgb(28, 146, 204); +} + +.feature-visual img, .feature-visual-narrow img { + left: auto; + right: 0; +} + +.navbar-head-narrow .navbar-brand, .navbar-head-narrow .navbar-brand a { + background-size: 168px 64px; +} + +.nav>ul a, +.nav>ul a:active, +.nav>ul a:hover { + cursor: pointer; +} + +a:focus, +a:-moz-focusring { + outline: 0 none; + cursor: pointer; +} + +div.leadText { + font-size: 20px; +} + +div.blue-box { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +div.blue-box-child { + background: rgb(28, 146, 204); + color: #fff; + margin: 12px; + width: 100%; + padding: 2%; +} + +@media (min-width:768px) { + div.blue-box-child { + margin: 12px 0; + width: calc(50% - 12px); + } +} + +div.blue-box-child p, +div.blue-box-child ul { + line-height: 1.2; + margin: 0; +} + +div.blue-box-child ul { + list-style: none; + padding-left: 12px; +} + +div.footer-copyright { + height: 100%; +} + +div.footer-copyright li.pull-right a { + color: #fff; +} + +div.page--contact a { + color: inherit; +} + +div.page--contact a:focus, +div.page--contact a:hover { + color: rgb(28, 146, 204); + cursor: pointer !important; + text-decoration: none; +} + +div.page--contact { + display: flex; + justify-content: space-between; + position: relative; + margin: 12px 0 24px 0; +} + +div.page--contact div.contact-child { + margin: 0; +} + +div.page--contact div.contact-child:nth-of-type(2) { + text-align: right; +} + +@media (max-width:767px) { + div.page--contact { + margin: 12px 12px 24px 12px; + } +} + +@media (max-width:439px) { + div.page--contact div.contact-child { + font-size: 10px; + } +} + +footer.footer li.back-top--hidden { + visibility: hidden; +} + +span.caret.caret_up { + transform: rotate(180deg); +} diff --git a/project.db b/project.db index 492e75b..3ac9d9e 100644 Binary files a/project.db and b/project.db differ diff --git a/project.db2 b/project.db2 new file mode 100644 index 0000000..fd048f9 Binary files /dev/null and b/project.db2 differ