-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
40 lines (30 loc) · 1.06 KB
/
config.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
32
33
34
35
36
37
38
39
40
from os import environ, path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv()
class Config(object):
DEBUG = False
TESTING = False
FLASK_DEBUG = 1
LOG_TO_STDOUT = environ.get('LOG_TO_STDOUT', False)
class DevelopmentConfig(Config):
"""
Staging URL Details and configs
"""
load_dotenv(path.join(basedir, 'dev.env'))
MYSQL_HOST = environ['MYSQL_HOST']
MYSQL_USER_NAME = environ['MYSQL_USER_NAME']
MYSQL_PASSWORD = environ['MYSQL_PASSWORD']
MYSQL_DATABASE_NAME = environ['MYSQL_DATABASE_NAME']
SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://{}:{}@{}/{}'.format(MYSQL_USER_NAME, MYSQL_PASSWORD, MYSQL_HOST,
MYSQL_DATABASE_NAME)
DEBUG = True
class ProductionConfig(Config):
load_dotenv(path.join(basedir, 'prod.env'))
DEBUG = False
config_data = {
'development': DevelopmentConfig,
'production': ProductionConfig
}
config_name = environ.get('APP_CONFIG', 'development')
config = config_data[config_name]