-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
41 lines (30 loc) · 1.05 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
import os
from app.utils.encoder import CustomEncoder
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
RESTFUL_JSON = {'cls': CustomEncoder}
SQLALCHEMY_TRACK_MODIFICATIONS = False
WECHAT_TOKEN = os.environ.get('WECHAT_TOKEN')
APPID = os.environ.get('APPID')
APPSECRET = os.environ.get('APPSECRET')
TEMPLATE_ID = os.environ.get('TEMPLATE_ID')
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = os.environ.get(
"PRO_DATABASE_URL"
) or "sqlite:///" + os.path.join(basedir, "data.sqlite")
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_ECHO = True
SQLALCHEMY_DATABASE_URI = os.environ.get(
"DEV_DATABASE_URL"
) or "sqlite:///" + os.path.join(basedir, "dev-data.sqlite")
class TestingConfig(Config):
TESTING = True
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get("TEST_DATABASE_URL") or "sqlite://"
config_map = {
"production": ProductionConfig,
"development": DevelopmentConfig,
"testing": TestingConfig,
"default": DevelopmentConfig,
}