-
Notifications
You must be signed in to change notification settings - Fork 9
/
settings.py
32 lines (19 loc) · 687 Bytes
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
import os
def loadSettings():
settings = None
sPaths = ['./settings.json', '../settings.json']
for sPath in sPaths:
if not os.path.exists(sPath):
continue
with open('./settings.json', 'r') as fp:
print("Found settings.json file! Loading settings.")
settings = json.load(fp)
if not settings and 'SCRAPE_CREDS' in os.environ:
print("Found 'SCRAPE_CREDS' environment variable! Loading settings.")
settings = json.loads(os.environ['SCRAPE_CREDS'])
return settings
SETTINGS = loadSettings()
SQLALCHEMY_DATABASE_URI = SETTINGS.get("sqlalchemy_db_uri", None)
if SQLALCHEMY_DATABASE_URI is None:
SQLALCHEMY_DATABASE_URI = 'sqlite:///db_sqlite.db'