From 0633b3efe992a1e5061d49241a5c7fb91c48b509 Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Sun, 11 Feb 2024 19:17:43 +0100 Subject: [PATCH 1/6] Update base-image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 56968bb..7fd3f0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim-bullseye +FROM python:3.12-slim-bookworm RUN apt update && apt install -y libpq-dev nginx gettext From 6b36ccc87a24e2758f8bf186eede4b0a0e3a32f7 Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Sun, 11 Feb 2024 19:17:59 +0100 Subject: [PATCH 2/6] Test testing --- .drone.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.drone.yml b/.drone.yml index 5fb8759..273f867 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,6 +3,17 @@ type: docker name: build-latest steps: +- name: test + image: python:3.12-slim-bookworm + settings: + repo: git.thisfro.ch/pflaenz.li/pflaenzli + commands: + - cd pflaenzli + - pip install coverage + - pip install -r requirements.txt + - coverage run --branch --source='.' manage.py test + - coverage report -m + - name: build-image image: plugins/docker settings: From 571918ec151e88ef4645c7e3cddaadbc68f5bcf2 Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Sun, 11 Feb 2024 19:19:22 +0100 Subject: [PATCH 3/6] Stay in top dir --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 273f867..6e2b7c1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,10 +8,9 @@ steps: settings: repo: git.thisfro.ch/pflaenz.li/pflaenzli commands: - - cd pflaenzli - pip install coverage - pip install -r requirements.txt - - coverage run --branch --source='.' manage.py test + - coverage run --branch --source='.' pflaenzli/manage.py test - coverage report -m - name: build-image From 55aed5f3461d24bf71f43365d531f5707fa6cdfa Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Sun, 11 Feb 2024 19:23:48 +0100 Subject: [PATCH 4/6] Add env vars --- .drone.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.drone.yml b/.drone.yml index 6e2b7c1..381e20e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,9 @@ steps: image: python:3.12-slim-bookworm settings: repo: git.thisfro.ch/pflaenz.li/pflaenzli + environment: + DJANGO_ALLOWED_HOSTS: localhost,[::1] + DJANGO_CSRF_TRUSTED_ORIGINS: http://localhost:8000 commands: - pip install coverage - pip install -r requirements.txt From 86060740d86fa59cce39655bc6ad0ca38e0617f5 Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Sun, 11 Feb 2024 19:27:44 +0100 Subject: [PATCH 5/6] Specify module to test --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 381e20e..df864fd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,7 +13,7 @@ steps: commands: - pip install coverage - pip install -r requirements.txt - - coverage run --branch --source='.' pflaenzli/manage.py test + - coverage run --branch --source='.' pflaenzli/manage.py test pflaenzli - coverage report -m - name: build-image From 1909861a1179613298af93a42406fa57394023b0 Mon Sep 17 00:00:00 2001 From: thisfro Date: Tue, 19 Nov 2024 23:02:00 +0100 Subject: [PATCH 6/6] Update django --- pflaenzli/pflaenzli/views.py | 2 +- pflaenzli/pflaenzli_django/settings.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pflaenzli/pflaenzli/views.py b/pflaenzli/pflaenzli/views.py index 772bad2..8fb8bc9 100644 --- a/pflaenzli/pflaenzli/views.py +++ b/pflaenzli/pflaenzli/views.py @@ -203,7 +203,7 @@ def get_single_plz(plz): def save_language(request): - referer_url = request.META.get('HTTP_REFERER') + referer_url = request.headers.get('referer') response = redirect(referer_url) if request.method == 'POST': diff --git a/pflaenzli/pflaenzli_django/settings.py b/pflaenzli/pflaenzli_django/settings.py index ea9fc1e..afb89b4 100644 --- a/pflaenzli/pflaenzli_django/settings.py +++ b/pflaenzli/pflaenzli_django/settings.py @@ -30,10 +30,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = "django-insecure-q=ps#iypevr!3zfpwtfp3lw#4r3%oyj*(2=*iq^8f4_zbodi^(" # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = os.getenv('DJANGO_DEBUG') == 'true' +DEBUG = True -ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',') -CSRF_TRUSTED_ORIGINS = os.getenv('DJANGO_CSRF_TRUSTED_ORIGINS', '').split(',') +ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', 'localhost').split(',') +CSRF_TRUSTED_ORIGINS = os.getenv('DJANGO_CSRF_TRUSTED_ORIGINS', 'http://localhost:8080').split(',') # Application definition