From d67f9ae1ba1f9212596df093443d0c0d928f4935 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 10:50:46 +0100 Subject: [PATCH 01/11] move docker image and update dependencies to works with python 3.12 --- .docker/backend/Dockerfile | 34 ++++++------ dev-requirements.txt | 105 +++++++++++++++++-------------------- docs/requirements.txt | 28 +++++----- requirements.txt | 103 +++++++++++++++++++----------------- 4 files changed, 132 insertions(+), 138 deletions(-) diff --git a/.docker/backend/Dockerfile b/.docker/backend/Dockerfile index 41659cd0..17ae76fd 100644 --- a/.docker/backend/Dockerfile +++ b/.docker/backend/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:jammy as base - -ENV PYTHONBUFFERED 1 -ENV DEBIAN_FRONTEND noninteractive -ENV LANG C.UTF-8 -ENV TZ UTC -ENV POSTGRES_HOST db -ENV POSTGRES_PORT 5432 +FROM ubuntu:noble AS base + +ENV PYTHONBUFFERED=1 +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV TZ=UTC +ENV POSTGRES_HOST=db +ENV POSTGRES_PORT=5432 ENV CUSTOM_SETTINGS_FILE="/opt/terra-visu/var/conf/custom.py" RUN apt-get -y -qq update \ @@ -19,12 +19,12 @@ RUN apt-get -y -qq update \ gettext \ postgresql-client \ tzdata \ - netcat \ + netcat-traditional \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/cache/apt/archives/* -RUN adduser docker --disabled-password +RUN useradd --system docker RUN mkdir -p /opt/terra-visu && chown docker:docker /opt WORKDIR /opt/terra-visu @@ -33,7 +33,7 @@ COPY .docker/backend/entrypoint.sh /usr/local/bin/entrypoint.sh ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] EXPOSE 8000 -FROM base as build +FROM base AS build RUN apt-get -y -qq update \ && apt-get -y -qq install \ @@ -48,23 +48,23 @@ RUN apt-get -y -qq update \ USER docker -RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade pip wheel +RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade pip<=24.3 wheel COPY requirements.txt /opt/terra-visu/requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir --upgrade -r /opt/terra-visu/requirements.txt -FROM build as dev +FROM build AS dev COPY dev-requirements.txt /opt/terra-visu/dev-requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir --upgrade -r /opt/terra-visu/dev-requirements.txt COPY .docker/backend/update.sh /usr/local/bin/update.sh -CMD /opt/venv/bin/python manage.py runserver 0.0.0.0:8000 +CMD ["/opt/venv/bin/python", "manage.py", "runserver", "0.0.0.0:8000"] -FROM base as prod +FROM base AS prod -ENV GUNICORN_WORKERS 1 -ENV GUNICORN_TIMEOUT 60 +ENV GUNICORN_WORKERS=1 +ENV GUNICORN_TIMEOUT=60 COPY --from=build /opt/venv /opt/venv diff --git a/dev-requirements.txt b/dev-requirements.txt index 1b8432e2..484c017a 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,20 +1,20 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --strip-extras dev-requirements.in +# pip-compile dev-requirements.in # alabaster==0.7.16 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx -asgiref==3.6.0 +asgiref==3.8.1 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # django babel==2.15.0 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx black==24.10.0 # via -r dev-requirements.in @@ -24,19 +24,19 @@ bpython==0.24 # via -r dev-requirements.in build==1.2.1 # via pip-tools -certifi==2024.7.4 +certifi==2024.8.30 # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # requests -charset-normalizer==3.1.0 +charset-normalizer==3.4.0 # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # requests -click==8.1.3 +click==8.1.7 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # black # pip-tools coverage==7.6.7 @@ -49,13 +49,13 @@ cwcwidth==0.1.9 # curtsies django==4.2.16 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # django-debug-toolbar django-debug-toolbar==4.4.6 # via -r dev-requirements.in docutils==0.20.1 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx # sphinx-rtd-theme factory-boy==3.3.1 @@ -68,33 +68,33 @@ freezegun==1.5.1 # via -r dev-requirements.in greenlet==3.0.3 # via bpython -idna==3.7 +idna==3.10 # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # requests imagesize==1.4.1 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx isort==5.13.2 # via -r dev-requirements.in jinja2==3.1.4 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx markupsafe==2.1.5 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # jinja2 mccabe==0.7.0 # via flake8 mypy-extensions==1.0.0 # via black -packaging==23.1 +packaging==24.2 # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # black # build # sphinx @@ -110,92 +110,83 @@ pyflakes==3.2.0 # via flake8 pygments==2.18.0 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # bpython # sphinx pyproject-hooks==1.1.0 # via # build # pip-tools -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # faker # freezegun pyxdg==0.28 # via bpython requests==2.32.3 # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # bpython # sphinx six==1.16.0 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # blessed # python-dateutil snowballstemmer==2.2.0 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinx==7.3.7 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx-rtd-theme # sphinxcontrib-jquery sphinx-rtd-theme==3.0.2 - # via -r docs/requirements.txt + # via -r /opt/terra-visu/docs/requirements.txt sphinxcontrib-applehelp==1.0.8 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinxcontrib-devhelp==1.0.6 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinxcontrib-htmlhelp==2.0.5 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinxcontrib-jquery==4.1 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx-rtd-theme sphinxcontrib-jsmath==1.0.1 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinxcontrib-qthelp==1.0.7 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx sphinxcontrib-serializinghtml==1.1.10 # via - # -r docs/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # sphinx -sqlparse==0.4.4 +sqlparse==0.5.2 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # django # django-debug-toolbar -tomli==2.0.1 +urllib3==2.2.3 # via - # -r docs/requirements.txt - # black - # build - # pip-tools - # sphinx -typing-extensions==4.12.2 - # via black -urllib3==1.26.19 - # via - # -c requirements.txt - # -r docs/requirements.txt + # -c /opt/terra-visu/requirements.txt + # -r /opt/terra-visu/docs/requirements.txt # requests -wcwidth==0.2.6 +wcwidth==0.2.13 # via - # -c requirements.txt + # -c /opt/terra-visu/requirements.txt # blessed wheel==0.43.0 # via pip-tools diff --git a/docs/requirements.txt b/docs/requirements.txt index ab728a79..9f528787 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --strip-extras @@ -8,21 +8,21 @@ alabaster==0.7.16 # via sphinx babel==2.15.0 # via sphinx -certifi==2024.7.4 +certifi==2024.8.30 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # requests -charset-normalizer==3.1.0 +charset-normalizer==3.4.0 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # requests docutils==0.20.1 # via # sphinx # sphinx-rtd-theme -idna==3.7 +idna==3.10 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # requests imagesize==1.4.1 # via sphinx @@ -30,15 +30,15 @@ jinja2==3.1.4 # via sphinx markupsafe==2.1.5 # via jinja2 -packaging==23.1 +packaging==24.2 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # sphinx pygments==2.18.0 # via sphinx requests==2.32.3 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # sphinx snowballstemmer==2.2.0 # via sphinx @@ -47,7 +47,7 @@ sphinx==7.3.7 # sphinx-rtd-theme # sphinxcontrib-jquery sphinx-rtd-theme==3.0.2 - # via -r docs/requirements.in + # via -r requirements.in sphinxcontrib-applehelp==1.0.8 # via sphinx sphinxcontrib-devhelp==1.0.6 @@ -62,9 +62,7 @@ sphinxcontrib-qthelp==1.0.7 # via sphinx sphinxcontrib-serializinghtml==1.1.10 # via sphinx -tomli==2.0.1 - # via sphinx -urllib3==1.26.19 +urllib3==2.2.3 # via - # -c docs/../requirements.txt + # -c /opt/terra-visu/requirements.txt # requests diff --git a/requirements.txt b/requirements.txt index b54c02d1..8f060a3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,22 +1,21 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --strip-extras # -amqp==5.1.1 +amqp==5.3.1 # via kombu -asgiref==3.6.0 +asgiref==3.8.1 # via # django # django-cors-headers -async-timeout==4.0.3 - # via redis -attrs==22.2.0 +attrs==24.2.0 # via # fiona # jsonschema -billiard==4.2.0 + # referencing +billiard==4.2.1 # via celery celery==5.4.0 # via @@ -24,18 +23,18 @@ celery==5.4.0 # django-celery-beat # django-celery-results # django-geostore -certifi==2024.7.4 +certifi==2024.8.30 # via # elastic-transport # fiona # pyproj # requests # sentry-sdk -cffi==1.15.1 +cffi==1.17.1 # via cryptography -charset-normalizer==3.1.0 +charset-normalizer==3.4.0 # via requests -click==8.1.3 +click==8.1.7 # via # celery # click-didyoumean @@ -44,25 +43,25 @@ click==8.1.3 # cligj # fiona # mercantile -click-didyoumean==0.3.0 +click-didyoumean==0.3.1 # via celery click-plugins==1.1.1 # via # celery # fiona -click-repl==0.2.0 +click-repl==0.3.0 # via celery cligj==0.7.2 # via fiona -conditional==1.4 +conditional==2.0 # via django-clone crispy-bootstrap5==2024.10 # via -r requirements.in -cron-descriptor==1.2.35 +cron-descriptor==1.4.5 # via django-celery-beat -cryptography==43.0.1 +cryptography==43.0.3 # via pyjwt -deepmerge==1.1.0 +deepmerge==2.0 # via django-geostore django==4.2.16 # via @@ -78,8 +77,8 @@ django==4.2.16 # django-filter # django-geostore # django-mapbox-baselayer - # django-picklefield # django-polymorphic + # django-timezone-field # django-tinymce # django-token-tools # djangorestframework @@ -102,7 +101,7 @@ django-clone==5.3.3 # via -r requirements.in django-colorfield==0.11.0 # via django-admin-interface -django-constance==3.1.0 +django-constance==4.1.3 # via -r requirements.in django-cors-headers==4.6.0 # via -r requirements.in @@ -111,16 +110,16 @@ django-crispy-forms==2.3 # -r requirements.in # crispy-bootstrap5 django-filter==24.3 - # via -r requirements.in + # via + # -r requirements.in + # djangorestframework-gis django-geostore==1.0.0 # via -r requirements.in django-mapbox-baselayer==1.0.0 # via -r requirements.in -django-picklefield==3.1 - # via django-constance django-polymorphic==3.1.0 # via -r requirements.in -django-timezone-field==5.0 +django-timezone-field==7.0 # via django-celery-beat django-tinymce==4.1.0 # via -r requirements.in @@ -133,7 +132,7 @@ djangorestframework==3.15.2 # drf-extra-fields # drf-jwt # drf-spectacular -djangorestframework-gis==1.0 +djangorestframework-gis==1.1 # via django-geostore drf-extra-fields==3.7.0 # via -r requirements.in @@ -141,7 +140,7 @@ drf-jwt==1.19.2 # via -r requirements.in drf-spectacular==0.27.2 # via -r requirements.in -ecdsa==0.18.0 +ecdsa==0.19.0 # via python-jose elastic-transport==8.15.1 # via elasticsearch @@ -153,19 +152,21 @@ fiona==1.10.1 # via # -r requirements.in # django-geostore -gpxpy==1.5.0 +gpxpy==1.6.2 # via django-geostore gunicorn==23.0.0 # via -r requirements.in -idna==3.7 +idna==3.10 # via requests inflection==0.5.1 # via drf-spectacular -jsonschema==4.17.3 +jsonschema==4.23.0 # via # django-geostore # drf-spectacular -kombu==5.3.4 +jsonschema-specifications==2024.10.1 + # via jsonschema +kombu==5.4.2 # via celery lml==0.1.0 # via @@ -175,39 +176,37 @@ mercantile==1.2.1 # via django-geostore openid-connect==0.5.0 # via django-auth-oidc -packaging==23.1 +packaging==24.2 # via gunicorn pillow==11.0.0 # via # -r requirements.in # django-colorfield -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.48 # via click-repl psycopg2==2.9.10 # via # -r requirements.in # django-geostore -pyasn1==0.4.8 +pyasn1==0.6.1 # via # python-jose # rsa -pycparser==2.21 +pycparser==2.22 # via cffi pyexcel==0.7.1 # via -r requirements.in -pyexcel-io==0.6.6 +pyexcel-io==0.6.7 # via pyexcel -pyjwt==2.6.0 +pyjwt==2.10.0 # via # drf-jwt # pyjwt pyproj==3.7.0 # via -r requirements.in -pyrsistent==0.19.3 - # via jsonschema -python-crontab==2.7.1 +python-crontab==3.2.0 # via django-celery-beat -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via # celery # python-crontab @@ -215,18 +214,24 @@ python-decouple==3.8 # via -r requirements.in python-jose==3.3.0 # via openid-connect -python-slugify==8.0.3 +python-slugify==8.0.4 # via django-admin-interface -pytz==2023.3 - # via django-timezone-field -pyyaml==6.0 +pyyaml==6.0.2 # via drf-spectacular redis==5.2.0 # via -r requirements.in +referencing==0.35.1 + # via + # jsonschema + # jsonschema-specifications requests==2.32.3 # via # django-geostore # openid-connect +rpds-py==0.21.0 + # via + # jsonschema + # referencing rsa==4.9 # via python-jose sentry-sdk==2.19.0 @@ -235,23 +240,23 @@ simplekml==1.3.6 # via django-geostore six==1.16.0 # via - # click-repl # django-clone # ecdsa # python-dateutil -sqlparse==0.4.4 +sqlparse==0.5.2 # via django text-unidecode==1.3 # via python-slugify -texttable==1.6.7 +texttable==1.7.0 # via pyexcel -tzdata==2023.3 +tzdata==2024.2 # via # celery # django-celery-beat + # kombu uritemplate==4.1.1 # via drf-spectacular -urllib3==1.26.19 +urllib3==2.2.3 # via # elastic-transport # requests @@ -261,5 +266,5 @@ vine==5.1.0 # amqp # celery # kombu -wcwidth==0.2.6 +wcwidth==0.2.13 # via prompt-toolkit From 7ab65a25c4bdeeb1e42f2d2c1fdcf9724877b2e4 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 10:51:50 +0100 Subject: [PATCH 02/11] set changelog.rst --- docs/source/others/changelog.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/others/changelog.rst b/docs/source/others/changelog.rst index c2266b45..c0ead44f 100644 --- a/docs/source/others/changelog.rst +++ b/docs/source/others/changelog.rst @@ -2,6 +2,14 @@ Changelog ========== +2024.06.0+dev (XXXX-XX-XX) +--------------------------- + +**Improvements:** + +- Update to python 3.12 + + 2024.06.0 (2024-06-21) --------------------------- From 5d9653e759de91f712bcd072b6b62d601312a921 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 11:21:57 +0100 Subject: [PATCH 03/11] fix pip --- .docker/backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/backend/Dockerfile b/.docker/backend/Dockerfile index 17ae76fd..a78ceb9d 100644 --- a/.docker/backend/Dockerfile +++ b/.docker/backend/Dockerfile @@ -48,7 +48,7 @@ RUN apt-get -y -qq update \ USER docker -RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade pip<=24.3 wheel +RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade "pip<24.3" wheel COPY requirements.txt /opt/terra-visu/requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir --upgrade -r /opt/terra-visu/requirements.txt From 2c45f7a22e8302fdb20d7628c001e830b7ec1c70 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 11:31:45 +0100 Subject: [PATCH 04/11] fix constance imort --- project/admin.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/project/admin.py b/project/admin.py index d680880b..e69de29b 100644 --- a/project/admin.py +++ b/project/admin.py @@ -1,12 +0,0 @@ -from constance import config -from django.contrib.admin import AdminSite -from django.utils.translation import gettext as _ - - -class ConfigSite(AdminSite): - site_header = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - site_title = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - index_title = _(f"Welcome to {config.INSTANCE_TITLE} configuration interface.") - - -config_site = ConfigSite(name="config_site") From cec4a475644694cab31aa9754fedabce7549df02 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 11:32:59 +0100 Subject: [PATCH 05/11] fix constance imort --- project/admin.py | 12 ++++++++++++ project/settings/__init__.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/project/admin.py b/project/admin.py index e69de29b..d680880b 100644 --- a/project/admin.py +++ b/project/admin.py @@ -0,0 +1,12 @@ +from constance import config +from django.contrib.admin import AdminSite +from django.utils.translation import gettext as _ + + +class ConfigSite(AdminSite): + site_header = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") + site_title = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") + index_title = _(f"Welcome to {config.INSTANCE_TITLE} configuration interface.") + + +config_site = ConfigSite(name="config_site") diff --git a/project/settings/__init__.py b/project/settings/__init__.py index 6d5d99bc..58afc4a5 100644 --- a/project/settings/__init__.py +++ b/project/settings/__init__.py @@ -43,8 +43,8 @@ # Application definition INSTALLED_APPS = [ "django.contrib.contenttypes", + "constance.backends.database", "constance", - "constance.backends.database", # constance: after contenttypes and before grappelli "admin_interface", "colorfield", "tinymce", From b0ef3f2a5d57c0565a1e791e2cd4a5682df3247b Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 12:28:25 +0100 Subject: [PATCH 06/11] fix constance imort --- project/admin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/project/admin.py b/project/admin.py index d680880b..80d56696 100644 --- a/project/admin.py +++ b/project/admin.py @@ -4,9 +4,10 @@ class ConfigSite(AdminSite): - site_header = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - site_title = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - index_title = _(f"Welcome to {config.INSTANCE_TITLE} configuration interface.") - + def __init__(self, name="config_site"): + super().__init__(name) + self.site_header = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") + self.site_title = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") + self.index_title = _(f"Welcome to {config.INSTANCE_TITLE} configuration interface.") config_site = ConfigSite(name="config_site") From ae603c9acce040b72ec368b15c5a11b155981660 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 12:53:32 +0100 Subject: [PATCH 07/11] fix constance imort --- project/admin.py | 10 ++++------ project/locales/en/LC_MESSAGES/django.po | 10 ++++------ project/locales/fr/LC_MESSAGES/django.po | 16 +++++++--------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/project/admin.py b/project/admin.py index 80d56696..f1a70478 100644 --- a/project/admin.py +++ b/project/admin.py @@ -1,13 +1,11 @@ -from constance import config from django.contrib.admin import AdminSite from django.utils.translation import gettext as _ class ConfigSite(AdminSite): - def __init__(self, name="config_site"): - super().__init__(name) - self.site_header = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - self.site_title = _(f"{config.INSTANCE_TITLE}: {_('Configuration')}") - self.index_title = _(f"Welcome to {config.INSTANCE_TITLE} configuration interface.") + site_header = _("TerraVisu: Configuration") + site_title = _("TerraVisu: Configuration") + index_title = _("Welcome to TerraVisu configuration interface.") + config_site = ConfigSite(name="config_site") diff --git a/project/locales/en/LC_MESSAGES/django.po b/project/locales/en/LC_MESSAGES/django.po index b8420cd7..c99eeec0 100644 --- a/project/locales/en/LC_MESSAGES/django.po +++ b/project/locales/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-21 10:54+0200\n" +"POT-Creation-Date: 2024-11-25 12:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,8 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#, python-brace-format -msgid "Welcome to {config.INSTANCE_TITLE} debug interface." +msgid "Welcome to TerraVisu debug interface." msgstr "" msgid "Accounts" @@ -93,11 +92,10 @@ msgstr "" msgid "OIDC connect" msgstr "" -msgid "{config.INSTANCE_TITLE}: {_('Configuration')}" +msgid "TerraVisu: Configuration" msgstr "" -#, python-brace-format -msgid "Welcome to {config.INSTANCE_TITLE} configuration interface." +msgid "Welcome to TerraVisu configuration interface." msgstr "" msgid "Instance customization" diff --git a/project/locales/fr/LC_MESSAGES/django.po b/project/locales/fr/LC_MESSAGES/django.po index 5f247f40..c20ffe30 100644 --- a/project/locales/fr/LC_MESSAGES/django.po +++ b/project/locales/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-21 10:56+0200\n" +"POT-Creation-Date: 2024-11-25 12:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,9 +18,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#, python-brace-format -msgid "Welcome to {config.INSTANCE_TITLE} debug interface." -msgstr "Bienvenue sur l'interface de debug de {config.INSTANCE_TITLE}." +msgid "Welcome to TerraVisu debug interface." +msgstr "Bienvenue sur l'interface de debug de TerraVisu." msgid "Accounts" msgstr "Comptes" @@ -95,12 +94,11 @@ msgstr "Mot de passe oubliƩ ?" msgid "OIDC connect" msgstr "Connexion via OIDC" -msgid "{config.INSTANCE_TITLE}: {_('Configuration')}" -msgstr "{config.INSTANCE_TITLE} : {_('Configuration')}" +msgid "TerraVisu: Configuration" +msgstr "" -#, python-brace-format -msgid "Welcome to {config.INSTANCE_TITLE} configuration interface." -msgstr "Bienvenue sur l'interface de configuration de {config.INSTANCE_TITLE}." +msgid "Welcome to TerraVisu configuration interface." +msgstr "Bienvenue sur l'interface de configuration de TerraVisu." msgid "Instance customization" msgstr "Personnalisation de l'instance" From 9ee5ecce954241a8859dfbfafd7648eb3c5a05c9 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 12:59:28 +0100 Subject: [PATCH 08/11] fix constance imort --- project/accounts/admin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project/accounts/admin.py b/project/accounts/admin.py index c617bd28..29f345ad 100644 --- a/project/accounts/admin.py +++ b/project/accounts/admin.py @@ -1,13 +1,12 @@ -from constance import config from django.contrib import admin from django.utils.translation import gettext_lazy as _ from project.accounts.models import FunctionalPermission, PermanentAccessToken, User from project.admin import config_site -admin.site.index_title = f'{config.INSTANCE_TITLE}: {_("Debug panel")}' -admin.site.site_header = f'{config.INSTANCE_TITLE}: {_("Debug panel")}' -admin.site.index_title = _(f"Welcome to {config.INSTANCE_TITLE} debug interface.") +admin.site.index_title = f'TerraVisu: {_("Debug panel")}' +admin.site.site_header = f'TerraVisu: {_("Debug panel")}' +admin.site.index_title = _("Welcome to TerraVisu debug interface.") admin.site.register(User) From 02ca79c176874077e64d82a48cd28c2f16558938 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 13:04:59 +0100 Subject: [PATCH 09/11] fix unitest assert deprecated in 3.12 --- project/geosource/tests/test_commands.py | 2 +- project/geosource/tests/test_geostore_callbacks.py | 2 +- project/terra_layer/tests/test_commands/test_layer_dump.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/project/geosource/tests/test_commands.py b/project/geosource/tests/test_commands.py index f83fe2d6..7b43b80f 100644 --- a/project/geosource/tests/test_commands.py +++ b/project/geosource/tests/test_commands.py @@ -77,7 +77,7 @@ def test_resync_all_sources_fail(self): new_callable=mock.PropertyMock, return_value=False, ): - with self.assertRaisesRegexp( + with self.assertRaisesRegex( MethodNotAllowed, 'Method "One job is still running on this source" not allowed.', ): diff --git a/project/geosource/tests/test_geostore_callbacks.py b/project/geosource/tests/test_geostore_callbacks.py index 3f95c204..020e7c38 100644 --- a/project/geosource/tests/test_geostore_callbacks.py +++ b/project/geosource/tests/test_geostore_callbacks.py @@ -52,7 +52,7 @@ def side_effect(msg): "project.geosource.geostore_callbacks.logger.warning", side_effect=side_effect, ): - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, "One record was ignored from source, because of " "invalid geometry: {'property': 'Hola'}", diff --git a/project/terra_layer/tests/test_commands/test_layer_dump.py b/project/terra_layer/tests/test_commands/test_layer_dump.py index 403c7f72..0087925b 100644 --- a/project/terra_layer/tests/test_commands/test_layer_dump.py +++ b/project/terra_layer/tests/test_commands/test_layer_dump.py @@ -72,7 +72,7 @@ def test_command_launch_without_custom_style(self, mock_sdout): def test_command_fail(self): out = StringIO() - with self.assertRaisesRegexp(CommandError, "Layer does not exist"): + with self.assertRaisesRegex(CommandError, "Layer does not exist"): call_command("layer_dump", pk=999, stdout=out) @mock.patch("sys.stdout", new_callable=StringIO) From fca1fc7579a1b52e1aa267eea0069ec4814b0ae2 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 13:05:16 +0100 Subject: [PATCH 10/11] fix version in newer docker compose files --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6848d1d2..69b5ce41 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.7" - x-images: django: &django build: From 59f23d640e86a88a259fc7ea7e2b4a917c15ade0 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 13:12:59 +0100 Subject: [PATCH 11/11] fix deprecated assertDictContainsSubset --- project/geosource/tests/test_api.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/project/geosource/tests/test_api.py b/project/geosource/tests/test_api.py index d8e114bd..7c985f09 100644 --- a/project/geosource/tests/test_api.py +++ b/project/geosource/tests/test_api.py @@ -144,9 +144,9 @@ def test_postgis_source_creation(self): {**self.source_example, "db_password": "test_password"}, format="json", ) - + data = response.json() self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertDictContainsSubset(self.source_example, response.json()) + self.assertEqual(data, data | self.source_example) @patch( "project.geosource.serializers.PostGISSourceSerializer._first_record", @@ -188,7 +188,8 @@ def test_postgis_source_creation_no_geom_field_good_geom(self): ) self.source_example["geom_field"] = "foo" self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertDictContainsSubset(self.source_example, response.json()) + data = response.json() + self.assertEqual(data, data | self.source_example) @patch( "project.geosource.serializers.requests.get", @@ -209,7 +210,8 @@ def test_wmts_source_creation(self, mocked_request_get): ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertDictContainsSubset(wmts_source, response.json()) + data = response.json() + self.assertEqual(data, data | wmts_source) @patch( "project.geosource.serializers.PostGISSourceSerializer._first_record",