From 13a317d3df27144bd7d322eb910dad36618a9a6e Mon Sep 17 00:00:00 2001 From: WGAVermeer <90707235+WGAVermeer@users.noreply.github.com> Date: Wed, 11 Mar 2026 08:12:07 +0100 Subject: [PATCH 1/8] Make Dev enters into the webserver shell. Fixed database env variables to properly connect. --- Makefile | 3 ++- compose.yaml | 4 +++- src/website/settings.py | 4 ++-- src/website/urls.py | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4e2289a..c61f5ba 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ prod: dev: docker compose down - docker compose -f ./compose.yaml -f ./compose.dev.yaml up --build + docker compose -f ./compose.yaml -f ./compose.dev.yaml up --build -d + docker exec -it quatsh-website-web-1 sh test: docker compose --env-file .env.template -f ./compose.yaml -f ./compose.test.yaml up --build --abort-on-container-exit --exit-code-from web diff --git a/compose.yaml b/compose.yaml index 36e320f..5fa3bbf 100644 --- a/compose.yaml +++ b/compose.yaml @@ -10,16 +10,18 @@ services: PYTHONDONTWRITEBYTECODE: 1 PYTHONUNBUFFERED: 1 DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE} + env_file: ".env" restart: unless-stopped db: image: postgres:18 environment: - POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_DB: ${POSTGRES_DBNAME} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} volumes: - postgres_data:/var/lib/postgresql + env_file: ".env" restart: unless-stopped adminer: diff --git a/src/website/settings.py b/src/website/settings.py index 7a4d735..2bdcd39 100644 --- a/src/website/settings.py +++ b/src/website/settings.py @@ -77,7 +77,7 @@ WSGI_APPLICATION = "website.wsgi.application" DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", - "DBNAME": os.getenv("POSTGRES_DBNAME"), + "NAME": os.getenv("POSTGRES_DBNAME"), "USER": os.getenv("POSTGRES_USER"), "PASSWORD": os.getenv("POSTGRES_PASSWORD"), "HOST": os.getenv("POSTGRES_HOST"), @@ -110,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [ LANGUAGE_CODE = "en-us" -TIME_ZONE = "UTC" +TIME_ZONE = "Europe/Amsterdam" USE_I18N = True diff --git a/src/website/urls.py b/src/website/urls.py index ac9ab57..37f07e2 100644 --- a/src/website/urls.py +++ b/src/website/urls.py @@ -14,9 +14,11 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ - path('admin/', admin.site.urls), + path("polls/", include("polls.urls")), + path("admin/", admin.site.urls), ] -- 2.49.1 From 26c6f46531c6e848fb779bd04587974544d3d192 Mon Sep 17 00:00:00 2001 From: WGAVermeer <90707235+WGAVermeer@users.noreply.github.com> Date: Wed, 11 Mar 2026 08:13:35 +0100 Subject: [PATCH 2/8] added poll app for testing purposes. Will be removed later. --- .gitignore | 4 ++++ src/polls/__init__.py | 0 src/polls/admin.py | 3 +++ src/polls/apps.py | 5 +++++ src/polls/migrations/__init__.py | 0 src/polls/models.py | 3 +++ src/polls/tests.py | 3 +++ src/polls/urls.py | 7 +++++++ src/polls/views.py | 9 +++++++++ 9 files changed, 34 insertions(+) create mode 100644 src/polls/__init__.py create mode 100644 src/polls/admin.py create mode 100644 src/polls/apps.py create mode 100644 src/polls/migrations/__init__.py create mode 100644 src/polls/models.py create mode 100644 src/polls/tests.py create mode 100644 src/polls/urls.py create mode 100644 src/polls/views.py diff --git a/.gitignore b/.gitignore index 738f029..7426210 100644 --- a/.gitignore +++ b/.gitignore @@ -175,3 +175,7 @@ cython_debug/ # PyPI configuration file .pypirc +# gunicon webserver +gunicorn.ctl + + diff --git a/src/polls/__init__.py b/src/polls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/polls/admin.py b/src/polls/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/src/polls/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/src/polls/apps.py b/src/polls/apps.py new file mode 100644 index 0000000..d0f109e --- /dev/null +++ b/src/polls/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PollsConfig(AppConfig): + name = 'polls' diff --git a/src/polls/migrations/__init__.py b/src/polls/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/polls/models.py b/src/polls/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/src/polls/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/src/polls/tests.py b/src/polls/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/src/polls/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/polls/urls.py b/src/polls/urls.py new file mode 100644 index 0000000..5119061 --- /dev/null +++ b/src/polls/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.index, name="index"), +] diff --git a/src/polls/views.py b/src/polls/views.py new file mode 100644 index 0000000..933bf0d --- /dev/null +++ b/src/polls/views.py @@ -0,0 +1,9 @@ +from django.shortcuts import render +from django.http import HttpResponse + + +def index(request): + return HttpResponse("Hello, world. You're at the polls index.") + + +# Create your views here. -- 2.49.1 From 357c81ff088cc06da58e96fc5a21224869e1c2e2 Mon Sep 17 00:00:00 2001 From: woutervermeer Date: Wed, 11 Mar 2026 07:30:02 +0000 Subject: [PATCH 3/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e91f22..abd0593 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Requirements: ### Install make -Running this requires the use of "make" and docker.\ +Running this requires the use of "make" and docker. "make" tends to come pre-installed on linux but not on Windows, to install it on Windows I recommend using Chocolatey as follows: \ ``` -- 2.49.1 From fe6c0df12351a6ba73289891c142ab567a1757f7 Mon Sep 17 00:00:00 2001 From: WGAVermeer <90707235+WGAVermeer@users.noreply.github.com> Date: Wed, 11 Mar 2026 09:21:36 +0100 Subject: [PATCH 4/8] Updated settings to import secret key. --- src/website/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/website/settings.py b/src/website/settings.py index 2bdcd39..a3c6b5c 100644 --- a/src/website/settings.py +++ b/src/website/settings.py @@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-c$q7wdq+u@ow74wp!&zzkxdylkueu)(+34e%!e0du&bjwoqz9z" +SECRET_KEY = os.environ["DJANGO_SECRET_KEY"] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool(os.getenv("DEBUG")) -- 2.49.1 From 01ea42b64ad6409be561243b380db3c409691aae Mon Sep 17 00:00:00 2001 From: WGAVermeer <90707235+WGAVermeer@users.noreply.github.com> Date: Wed, 11 Mar 2026 09:22:58 +0100 Subject: [PATCH 5/8] default to non-debug mode. --- src/website/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/website/settings.py b/src/website/settings.py index a3c6b5c..0264fb5 100644 --- a/src/website/settings.py +++ b/src/website/settings.py @@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ["DJANGO_SECRET_KEY"] # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(os.getenv("DEBUG")) +DEBUG = bool(os.getenv("DEBUG", False)) ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",") -- 2.49.1 From f8dc8fc6845902e170b76bb8374a760ae2689993 Mon Sep 17 00:00:00 2001 From: WGAVermeer <90707235+WGAVermeer@users.noreply.github.com> Date: Wed, 11 Mar 2026 09:24:45 +0100 Subject: [PATCH 6/8] remove hardcoded .env --- compose.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index 5fa3bbf..4c14151 100644 --- a/compose.yaml +++ b/compose.yaml @@ -10,7 +10,6 @@ services: PYTHONDONTWRITEBYTECODE: 1 PYTHONUNBUFFERED: 1 DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE} - env_file: ".env" restart: unless-stopped db: @@ -21,7 +20,6 @@ services: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} volumes: - postgres_data:/var/lib/postgresql - env_file: ".env" restart: unless-stopped adminer: -- 2.49.1 From cba945375c3aeac30f00a8b8f59dcc9de9f2d5c0 Mon Sep 17 00:00:00 2001 From: woutervermeer Date: Wed, 11 Mar 2026 08:38:29 +0000 Subject: [PATCH 7/8] Update .gitea/workflows/deploy.yml --- .gitea/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 6f925f9..7939c2d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -31,5 +31,8 @@ jobs: echo "Building containers..." make prod + echo "Running Django deploy check" + docker compose run --rm web python manage.py check --deploy + echo "Deployment complete." EOF \ No newline at end of file -- 2.49.1 From 41a61fb3187c477524f87b2362289da484e802da Mon Sep 17 00:00:00 2001 From: woutervermeer Date: Wed, 11 Mar 2026 08:38:41 +0000 Subject: [PATCH 8/8] Update .gitea/workflows/build_test.yaml --- .gitea/workflows/build_test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/build_test.yaml b/.gitea/workflows/build_test.yaml index b959ef6..f71de77 100644 --- a/.gitea/workflows/build_test.yaml +++ b/.gitea/workflows/build_test.yaml @@ -4,6 +4,7 @@ on: push: branches: - pre-prod + - main pull_request: jobs: -- 2.49.1