From 551468470ff29aa676b162143d44befde4ffeb66 Mon Sep 17 00:00:00 2001 From: Lebaud Antoine Date: Sat, 24 Feb 2024 12:44:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(project)=20run=20production=20imag?= =?UTF-8?q?e=20locally=20with=20docker-compose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local deployment of the Production image through docker-compose was failing due to issues in the Django configurations, influenced by Joanie. The bug stemmed from a dependency on a development-specific package (drf-spectacular-sidecar) while attempting to run the application in production mode. Changes Made: - Introduced new Django settings for local demo environments. --- docker-compose.yml | 4 ++-- src/backend/publish/settings.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fc31bf57..ea01c8d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,7 +66,7 @@ services: user: ${DOCKER_USER:-1000} image: publish:production environment: - - DJANGO_CONFIGURATION=ContinuousIntegration + - DJANGO_CONFIGURATION=Demo env_file: - env.d/development/common - env.d/development/postgresql @@ -81,7 +81,7 @@ services: image: publish:production command: ["celery", "-A", "publish.celery_app", "worker", "-l", "INFO"] environment: - - DJANGO_CONFIGURATION=ContinuousIntegration + - DJANGO_CONFIGURATION=Demo env_file: - env.d/development/common - env.d/development/postgresql diff --git a/src/backend/publish/settings.py b/src/backend/publish/settings.py index 91d74fd6..db117245 100755 --- a/src/backend/publish/settings.py +++ b/src/backend/publish/settings.py @@ -554,3 +554,20 @@ class PreProduction(Production): nota bene: it should inherit from the Production environment. """ + + +class Demo(Production): + """ + Demonstration environment settings + + nota bene: it should inherit from the Production environment. + """ + + STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, + }