Skip to content

Commit 3f12e9b

Browse files
committed
Upgrade Wagtail 7.4 LTS + Django 6.0
1 parent 2c20718 commit 3f12e9b

11 files changed

Lines changed: 53 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set up Python
3030
uses: actions/setup-python@v4
3131
with:
32-
python-version: "3.9"
32+
python-version: "3.12"
3333
#cache: pip
3434
#cache-dependency-path: |
3535
# requirements/base.txt

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,7 @@ cython_debug/
173173

174174
# End of https://www.toptal.com/developers/gitignore/api/django
175175

176-
llama3/llama-3.2/*
176+
llama3/llama-3.2/*
177+
178+
# Local vendor dir for one-off translation scripts (deep-translator)
179+
.vendor_trans/

compose/local/django/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.11-bullseye
1+
ARG PYTHON_VERSION=3.12-bookworm
22

33
# define an alias for the specfic python version used in this file.
44
FROM python:${PYTHON_VERSION} AS python
@@ -20,11 +20,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
2020
libopenblas-dev \
2121
libomp-dev
2222

23-
# Instalar gcc-10 y g++-10 en Debian Bullseye
2423
RUN apt-get update && \
25-
apt-get install -y gcc-10 g++-10 ninja-build cmake && \
26-
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 50 && \
27-
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 50 && \
24+
apt-get install -y ninja-build cmake && \
2825
apt-get clean && rm -rf /var/lib/apt/lists/*
2926

3027
# Actualizar pip, setuptools y wheel antes de instalar dependencias
@@ -55,7 +52,11 @@ ENV BUILD_ENV ${BUILD_ENVIRONMENT}
5552

5653
WORKDIR ${APP_HOME}
5754

58-
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
55+
RUN if [ -f /etc/apt/sources.list ]; then \
56+
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
57+
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
58+
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
59+
fi
5960

6061
# Install required system dependencies
6162
RUN apt-get update && apt-get install --no-install-recommends -y \

compose/production/django/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.11-bullseye
1+
ARG PYTHON_VERSION=3.12-bookworm
22

33
# define an alias for the specfic python version used in this file.
44
FROM python:${PYTHON_VERSION} as python
@@ -44,7 +44,11 @@ WORKDIR ${APP_HOME}
4444
RUN addgroup --system django \
4545
&& adduser --system --ingroup django django
4646

47-
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
47+
RUN if [ -f /etc/apt/sources.list ]; then \
48+
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
49+
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
50+
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
51+
fi
4852

4953
# Install required system dependencies
5054
RUN apt-get update && apt-get install --no-install-recommends -y \

compose/production/django/Dockerfile.llama

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.11-bullseye
1+
ARG PYTHON_VERSION=3.12-bookworm
22

33
# define an alias for the specfic python version used in this file.
44
FROM python:${PYTHON_VERSION} as python
@@ -50,7 +50,11 @@ WORKDIR ${APP_HOME}
5050
RUN addgroup --system django \
5151
&& adduser --system --ingroup django django
5252

53-
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
53+
RUN if [ -f /etc/apt/sources.list ]; then \
54+
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
55+
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
56+
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
57+
fi
5458

5559
# Install required system dependencies
5660
RUN apt-get update && apt-get install --no-install-recommends -y \

config/settings/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"django.contrib.admin",
6363
"django.contrib.auth",
6464
"django.contrib.contenttypes",
65+
"django.contrib.postgres",
6566
"django.contrib.sessions",
6667
"django.contrib.messages",
6768
"django.contrib.staticfiles",

config/settings/local.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
# SECURITY WARNING: define the correct hosts in production!
2323
ALLOWED_HOSTS = ["*"]
24+
CSRF_TRUSTED_ORIGINS = env.list(
25+
"DJANGO_CSRF_TRUSTED_ORIGINS",
26+
default=["https://tools-hml.scielo.org"],
27+
)
2428

2529
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
2630

config/settings/production.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
SECRET_KEY = env("DJANGO_SECRET_KEY")
1616
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
1717
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["example.com"])
18+
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-trusted-origins
19+
CSRF_TRUSTED_ORIGINS = env.list("DJANGO_CSRF_TRUSTED_ORIGINS", default=[])
1820

1921
# DATABASES
2022
# ------------------------------------------------------------------------------

markup_doc/wagtail_hooks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
from django.db import transaction
12
from django.http import HttpResponseRedirect
2-
from django.utils.translation import gettext_lazy as _
33
from django.template.response import TemplateResponse
4+
from django.templatetags.static import static
5+
from django.urls import path
6+
from django.utils.html import format_html
7+
from django.utils.translation import gettext_lazy as _
8+
from wagtail import hooks
9+
from wagtail.admin import messages
410
from wagtail_modeladmin.options import ModelAdmin
5-
11+
from wagtail.snippets.models import register_snippet
612
from wagtail.snippets.views.snippets import (
713
CreateView,
814
EditView,
@@ -20,13 +26,9 @@
2026
ProcessStatus
2127
)
2228

23-
from markup_doc.tasks import get_labels, task_sync_journals_from_api
24-
from wagtail.admin import messages
25-
26-
from wagtail.snippets.models import register_snippet
27-
from django.db import transaction
28-
29+
from markup_doc import views
2930
from markup_doc.sync_api import sync_collection_from_api
31+
from markup_doc.tasks import get_labels, task_sync_journals_from_api, update_xml
3032

3133

3234

requirements/base.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
setuptools>=68.2.2,<82
12
whitenoise==6.6.0 # https://github.com/evansd/whitenoise
23
redis==5.0.1 # https://github.com/redis/redis-py
34
celery==5.3.6 # pyup: < 6.0 # https://github.com/celery/celery
@@ -6,22 +7,19 @@ hiredis==2.2.3 # https://github.com/redis/hiredis-py
67

78
# Django
89
# ------------------------------------------------------------------------------
9-
django==5.0.8
10-
django-environ==0.11.2
11-
djangorestframework==3.15.2
12-
djangorestframework-simplejwt==5.3.1 # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
13-
django-celery-beat==2.6.0 # https://github.com/celery/django-celery-beat
14-
django_celery_results==2.5.1
15-
django-compressor==4.4 # https://github.com/django-compressor/django-compressor
10+
django==6.0.5
11+
django-environ==0.13.0
12+
djangorestframework==3.17.1
13+
djangorestframework-simplejwt==5.5.1 # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
14+
django-celery-beat==2.9.0 # https://github.com/celery/django-celery-beat
15+
django_celery_results==2.6.0
16+
django-compressor==4.6.0 # https://github.com/django-compressor/django-compressor
1617

1718
# Wagtail
1819
# ------------------------------------------------------------------------------
19-
wagtail==6.3
20-
wagtail-modeladmin==2.1.0
21-
wagtail-django-recaptcha==2.1.1
22-
wagtailmenus==3.1.9
23-
wagtail-localize==1.8.2
24-
wagtail-autocomplete==0.11.0
20+
wagtail==7.4
21+
wagtail-modeladmin==2.3.0
22+
wagtail-autocomplete==0.12.0
2523

2624
# lxml
2725
# ------------------------------------------------------------------------------
@@ -55,8 +53,3 @@ python-docx==1.1.2
5553
# huggingface-hub
5654
# ------------------------------------------------------------------------------
5755
huggingface_hub==0.26.1 # https://pypi.org/project/huggingface-hub/
58-
59-
# Python Bindings for llama.cpp
60-
# ------------------------------------------------------------------------------
61-
llama-cpp-python==0.3.14 # https://llama-cpp-python.readthedocs.io/en/latest/
62-

0 commit comments

Comments
 (0)