Skip to content

Commit

Permalink
improve test settigns to add use docker setting - default to true (#1019
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ptitloup authored Jan 11, 2024
1 parent 96f135b commit 1c74d70
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pod/main/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
TEMPLATES[0]["DIRS"].append(
os.path.join(settings_base_dir, "custom", "static", "opencast")
)
USE_DOCKER = True
path = "pod/custom/settings_local.py"
if os.path.exists(path):
_temp = __import__("pod.custom", globals(), locals(), ["settings_local"])
USE_DOCKER = getattr(_temp.settings_local, "USE_DOCKER", True)

for application in INSTALLED_APPS:
if application.startswith("pod"):
Expand All @@ -28,7 +33,6 @@
if variable == variable.upper():
locals()[variable] = getattr(_temp.settings, variable)


DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
Expand Down Expand Up @@ -94,9 +98,10 @@ def get_shared_secret():
XAPI_LRS_PWD = ""

# Uniquement lors d'environnement conteneurisé
MIGRATION_MODULES = {"flatpages": "pod.db_migrations"}
MIGRATION_DIRECTORY = os.path.join(settings_base_dir, "db_migrations")
if not os.path.exists(MIGRATION_DIRECTORY):
os.mkdir(MIGRATION_DIRECTORY)
file = os.path.join(MIGRATION_DIRECTORY, "__init__.py")
open(file, "a").close()
if USE_DOCKER :
MIGRATION_MODULES = {"flatpages": "pod.db_migrations"}
MIGRATION_DIRECTORY = os.path.join(settings_base_dir, "db_migrations")
if not os.path.exists(MIGRATION_DIRECTORY):
os.mkdir(MIGRATION_DIRECTORY)
file = os.path.join(MIGRATION_DIRECTORY, "__init__.py")
open(file, "a").close()

0 comments on commit 1c74d70

Please sign in to comment.