-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
executable file
·41 lines (32 loc) · 1.01 KB
/
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
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from environs import Env
from core import env
class BaseConfig(object):
TESTING = True
DEBUG = True
SQLALCHEMY_DATABASE_URI = env.get('DATABASE_URI')
SQLALCHEMY_TRACK_MODIFICATIONS = False
CELERY=dict(
broker_url='redis://{host}:{port}/{database}'.format(host=env.get('REDIS_HOST'), port=env.get('REDIS_PORT'), database=env.get('REDIS_DB')),
result_backend='redis://{host}:{port}/{database}'.format(host=env.get('REDIS_HOST'), port=env.get('REDIS_PORT'), database=env.get('REDIS_DB')),
task_ignore_result=True,
queues={
'default': {
'exchange': 'default',
'binding_key': 'task.default',
}
}
)
class ProductionConfig(BaseConfig):
TESTING = False
DEBUG = False
class DevelopConfig(BaseConfig):
TESTING = True
DEBUG = True
configs = {
# 生产环境
'production': ProductionConfig,
# 测试环境
'development': DevelopConfig
}