From 739a91ab2f9bd4f567139587cc0bedef7ca66fe6 Mon Sep 17 00:00:00 2001 From: vincent porte Date: Tue, 10 Dec 2024 11:49:29 +0100 Subject: [PATCH 1/3] refactor: replace locmemcache with databasecache --- config/settings/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/settings/base.py b/config/settings/base.py index b918b019..15a5a00a 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -253,7 +253,8 @@ # https://docs.djangoproject.com/en/4.1/topics/cache/ CACHES = { "default": { - "BACKEND": "django.core.cache.backends.locmem.LocMemCache", + "BACKEND": "django.core.cache.backends.db.DatabaseCache", + "LOCATION": "cache_table", }, "machina_attachments": { "BACKEND": "django.core.cache.backends.filebased.FileBasedCache", From 823edb7fd2efec62890a67e34444473f3cd8c6e9 Mon Sep 17 00:00:00 2001 From: vincent porte Date: Tue, 10 Dec 2024 13:36:00 +0100 Subject: [PATCH 2/3] setup cache table in CI and during deployement --- .github/workflows/ci.yml | 2 ++ clevercloud/python.json | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 423f8214..84d9cd75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,8 @@ jobs: pip install -r requirements/dev.txt - name: ✨ Black, ruff & djlint run: make quality + - name: 🚧 create cache table + run: python manage.py createcachetable - name: 🚧 collect static for testing purposes run: | python manage.py collectstatic diff --git a/clevercloud/python.json b/clevercloud/python.json index 370ab189..30b0fdc8 100644 --- a/clevercloud/python.json +++ b/clevercloud/python.json @@ -6,6 +6,7 @@ "module": "config.wsgi:application", "managetasks": [ "migrate --no-input", + "createcachetable", "collectstatic --no-input", "compilemessages", "compress" From 1561f2bd77e30c676f056f2cd95fd4083f1e5843 Mon Sep 17 00:00:00 2001 From: vincent porte Date: Tue, 10 Dec 2024 17:54:36 +0100 Subject: [PATCH 3/3] update README with createcachetable command --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4694b97f..f96c6abd 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ $ docker-compose --profile django up ## Préparer l'environnement de données ```bash +$ python manage.py createcachetable $ python manage.py migrate $ python manage.py populate $ python manage.py configure_bucket