Added conditional env loading.

Making it work in both dev and production without changing .env files.
This commit is contained in:
Vivek Santayana 2022-06-17 01:10:11 +01:00
parent fbae88eed1
commit 225ef71518

View File

@ -1,6 +1,10 @@
import os import os
from pathlib import Path from pathlib import Path
if not os.getenv('DATA'):
from dotenv import load_dotenv
load_dotenv('../.env')
class Config(object): class Config(object):
APP_HOST = '0.0.0.0' APP_HOST = '0.0.0.0'
DATA = os.getenv('DATA') DATA = os.getenv('DATA')