-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.py
76 lines (67 loc) · 1.85 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
DIALECT = 'mysql'
DRIVER = 'pymysql'
USERNAME = os.getenv("WORKBENCH_USERNAME")
PASSWORD = os.getenv("WORKBENCH_PASSWORD")
HOST = os.getenv("WORKBENCH_HOST")
PORT = 3306
DATABASE = os.getenv("WORKBENCH_DBNAME")
class Config:
SECRET_KEY = os.getenv("WORKBENCH_SECRET_WORK_KEY")
SESSION_TYPE = 'filesystem'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
ACCESS_KEY = os.environ.get('WORKBENCH_ACCESS_KEY')
FILE_SECRET_KEY = os.environ.get('WORKBENCH_SECRET_KEY')
URL = os.environ.get('WORKBENCH_URL')
# redis
REDISHOST = os.environ.get('WORKBENCH_REDISHOST') or "localhost"
REDISPORT = os.environ.get('WORKBENCH_REDISPORT') or 6379
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = \
"{}+{}://{}:{}@{}:{}/{}?charset=utf8".format(
DIALECT,
DRIVER,
USERNAME,
PASSWORD,
HOST,
PORT,
DATABASE
)
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = \
"{}+{}://{}:{}@{}:{}/{}?charset=utf8".format(
DIALECT,
DRIVER,
USERNAME,
PASSWORD,
HOST,
PORT,
DATABASE
)
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = \
"{}+{}://{}:{}@{}:{}/{}?charset=utf8".format(
DIALECT,
DRIVER,
USERNAME,
PASSWORD,
HOST,
PORT,
DATABASE
)
@classmethod
def init_app(cls, app):
Config.init_app(app)
config = {
'developments': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}