From 6d9877e4eb6ab73553694117ad07993349035a81 Mon Sep 17 00:00:00 2001 From: Jan Haase <105806818+cheminfolab@users.noreply.github.com> Date: Sat, 6 Apr 2024 11:46:09 +0200 Subject: [PATCH] renamed .env to .backend.env, tried different setting of environment variables --- README.md | 6 +++++- backend/api/settings.py | 4 +++- docker-compose.yml | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a98852a..28d9b70 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,11 @@ npm install ### Docker ````bash -docker compose -d --build +docker compose up -d --build +```` +or with a respective .env file: +````bash +docker compose --env-file .backend.env up -d --build ```` ### Native diff --git a/backend/api/settings.py b/backend/api/settings.py index 5dcddaa..0ab1050 100644 --- a/backend/api/settings.py +++ b/backend/api/settings.py @@ -11,9 +11,11 @@ """ from pathlib import Path -from decouple import config, Csv +from decouple import config, Csv # Config, RepositoryEnv, Csv # from datetime import timedelta +# config = Config(RepositoryEnv(Path(Path(__file__).resolve().parent.parent.parent, ".backend.env"))) + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent diff --git a/docker-compose.yml b/docker-compose.yml index 3a7567f..85e586f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: container_name: eln_db #restart: unless-stopped image: postgres:15.1 - env_file: .env + env_file: .backend.env volumes: - eln_db:/var/lib/postgresql/data/ ports: @@ -20,7 +20,7 @@ services: build: context: ./backend dockerfile: Dockerfile - env_file: .env + env_file: .backend.env environment: - POSTGRES_HOST=database ports: