From b4a1b2baeb6211b4a0acb244c0afbecd2013e595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Wed, 24 Dec 2025 12:32:56 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=9A=80=20feat:=20upgrade=20to=20Djang?= =?UTF-8?q?o=206.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrade Django from 5.2.9 to 6.0 by updating requirements files. - Update requirements/main.txt: Django 5.2.9 → 6.0 - Update requirements/dev.txt: Django 5.2.9 → 6.0 - All 33 tests pass successfully - Wagtail 7.2.1 supports Django 6.0 Django 6.0 was released on December 3, 2025: https://docs.djangoproject.com/en/6.0/releases/6.0/ Wagtail 7.2.x supports Django 6.0: https://github.com/wagtail/wagtail/pull/13622 Closes #173 --- requirements/dev.txt | 2 +- requirements/main.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 5209d41..ab0ca7f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -24,7 +24,7 @@ defusedxml==0.7.1 # via # -c requirements/main.txt # py-serializable -django==5.2.9 +django==6.0 # via # -c requirements/main.txt # django-debug-toolbar diff --git a/requirements/main.txt b/requirements/main.txt index d165fbf..4126c6a 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -32,7 +32,7 @@ dj-database-url==3.0.1 # via -r requirements/main.in dj-static==0.0.6 # via -r requirements/main.in -django==5.2.9 +django==6.0 # via # -r requirements/main.in # dj-database-url From 82ba247a23056fcea62de9bf346bc3a69995f631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Wed, 24 Dec 2025 13:27:24 +0100 Subject: [PATCH 2/3] fix: add django.contrib.postgres to INSTALLED_APPS for Django 6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Django 6.0 requires django.contrib.postgres to be explicitly added to INSTALLED_APPS when using PostgreSQL-specific features like SearchVectorField and GinIndex. This fixes the Heroku deployment error: wagtailsearch.IndexEntry: (postgres.E005) 'django.contrib.postgres' must be in INSTALLED_APPS in order to use SearchVectorField and GinIndex. Fixes deployment issue with Django 6.0 upgrade from PR #179. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- pythonie/pythonie/settings/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythonie/pythonie/settings/base.py b/pythonie/pythonie/settings/base.py index cf463f7..abdd645 100644 --- a/pythonie/pythonie/settings/base.py +++ b/pythonie/pythonie/settings/base.py @@ -43,6 +43,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "django.contrib.postgres", "compressor", "taggit", "modelcluster", From 6cfe3a83e886ca0cf3b90efe310cdb304ff1e81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Wed, 24 Dec 2025 15:19:15 +0100 Subject: [PATCH 3/3] fix: configure PostgreSQL for CI tests and move psycopg to main dependencies Changes: - Add PostgreSQL 17 service to GitHub Actions workflow - Configure tests to use PostgreSQL in CI (via DATABASE_URL) while keeping SQLite for local development - Move psycopg[binary] from production.in to main.in since django.contrib.postgres is now in base INSTALLED_APPS - Update workflow to install production.txt dependencies - Recompile all requirements files This fixes the test failure where django.contrib.postgres required psycopg to be installed but it was only available in production dependencies, not in the CI test environment. The conditional database configuration in tests.py allows: - CI: Uses PostgreSQL (matching production environment) - Local dev: Uses SQLite (simpler setup without PostgreSQL requirement) Fixes the Django 6.0 compatibility issue from the previous commit. --- .github/workflows/test.yml | 19 ++++++++++++++++++- pythonie/pythonie/settings/tests.py | 16 ++++++++++------ requirements/main.in | 1 + requirements/main.txt | 5 +++++ requirements/production.in | 6 ++---- requirements/production.txt | 8 -------- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed41256..5cfeb7e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,8 +5,25 @@ jobs: build: name: Execute tests runs-on: ubuntu-latest + + services: + postgres: + image: postgres:17 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test_db + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + env: DJANGO_SETTINGS_MODULE: pythonie.settings.tests + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db + steps: - uses: actions/checkout@v2 - name: Set Up Python 3.12 @@ -16,7 +33,7 @@ jobs: - name: Install the dependencies run: | python -m pip install --upgrade pip setuptools uv - python -m uv pip install -r requirements/main.txt -r requirements/dev.txt + python -m uv pip install -r requirements/main.txt -r requirements/dev.txt -r requirements/production.txt - name: Run the tests run: | python pythonie/manage.py test pythonie --verbosity=2 diff --git a/pythonie/pythonie/settings/tests.py b/pythonie/pythonie/settings/tests.py index aa6c9cb..6bb5e72 100644 --- a/pythonie/pythonie/settings/tests.py +++ b/pythonie/pythonie/settings/tests.py @@ -10,13 +10,17 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" -# SQLite (simplest install) -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": join(PROJECT_ROOT, "db.sqlite3"), +# Use PostgreSQL if DATABASE_URL is set (for CI), otherwise use SQLite (for local tests) +if os.getenv("DATABASE_URL"): + DATABASES = {"default": dj_database_url.config(conn_max_age=500)} +else: + # SQLite (simplest install for local development) + DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": join(PROJECT_ROOT, "db.sqlite3"), + } } -} LOGGING.update( { diff --git a/requirements/main.in b/requirements/main.in index 7bb8227..1b3aafe 100644 --- a/requirements/main.in +++ b/requirements/main.in @@ -15,6 +15,7 @@ django-storages django-taggit gunicorn pandas +psycopg[binary] pydantic python-dateutil pytz diff --git a/requirements/main.txt b/requirements/main.txt index 4126c6a..656a368 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -123,6 +123,10 @@ pillow==12.0.0 # wagtail pillow-heif==1.1.1 # via willow +psycopg==3.3.2 + # via -r requirements/main.in +psycopg-binary==3.3.2 + # via psycopg pydantic==2.12.5 # via -r requirements/main.in pydantic-core==2.41.5 @@ -167,6 +171,7 @@ typing-extensions==4.15.0 # beautifulsoup4 # django-stubs-ext # django-tasks + # psycopg # pydantic # pydantic-core # typing-inspection diff --git a/requirements/production.in b/requirements/production.in index a1fe1cc..df70576 100644 --- a/requirements/production.in +++ b/requirements/production.in @@ -1,4 +1,2 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile --output-file requirements/production.in requirements/production.txt --c main.txt -psycopg[binary] \ No newline at end of file +# production.in +-c main.txt \ No newline at end of file diff --git a/requirements/production.txt b/requirements/production.txt index 91dc57d..ccc6aaa 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,10 +1,2 @@ # This file was autogenerated by uv via the following command: # uv pip compile --output-file requirements/production.txt requirements/production.in -psycopg==3.2.13 - # via -r requirements/production.in -psycopg-binary==3.2.13 - # via psycopg -typing-extensions==4.15.0 - # via - # -c requirements/main.txt - # psycopg