From 225ef71518148db9277941e03d23cad1e70d41c2 Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Fri, 17 Jun 2022 01:10:11 +0100 Subject: [PATCH] Added conditional env loading. Making it work in both dev and production without changing .env files. --- ref-test/app/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ref-test/app/config.py b/ref-test/app/config.py index 1f69fc5..b70db97 100644 --- a/ref-test/app/config.py +++ b/ref-test/app/config.py @@ -1,6 +1,10 @@ import os from pathlib import Path +if not os.getenv('DATA'): + from dotenv import load_dotenv + load_dotenv('../.env') + class Config(object): APP_HOST = '0.0.0.0' DATA = os.getenv('DATA')