Environment file path is absolute

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-03-09 09:39:57 +01:00
parent e95a8b6e18
commit b5ef937a03
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,7 @@ def read_env():
directory. directory.
""" """
try: try:
with open('.env') as f: with open(os.path.join(BASE_DIR, '.env')) as f:
content = f.read() content = f.read()
except IOError: except IOError:
content = '' content = ''
@ -30,6 +30,7 @@ def read_env():
# Try to load environment variables from project .env # Try to load environment variables from project .env
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
read_env() read_env()
# Load base settings # Load base settings