-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.py
133 lines (112 loc) · 3.13 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = Lyon
import os
import logging
from base.conf import BaseConfig
class Config(BaseConfig):
"""Public config"""
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
DEBUG = True
NO_KEEP_ALIVE = True
################
# Tornado Docs #
################
INSTALL_HANDLERS = [
'api.users.user',
'api.fund.fund',
'api.fund.optional',
'api.fund.trade',
'api.fund.simulate',
]
INSTALL_HANDLERS_NAME = {
'api.users.user': '用户API',
'api.fund.fund': '基金API',
'api.fund.optional': '自选API',
'api.fund.trade': '交易API',
'api.fund.simulate': '基金模拟API'
}
DOCS_USERNAME = 'admin'
DOCS_PASSWORD = 'admin'
DOCS_GLOBAL_PARAMS = []
DOCS_GLOBAL_HEADERS = [
('Authorization', False, str, '')
]
DOCS_TOKEN_VERIFY_EXPIRE = True
DOCS_TOKEN_EXPIRE_DAYS = 30
DOCS_TOKEN_SECRET_KEY = '8i-!yfmt+hk@-$e7%wl2hx#!v7+rjdc%s8udl0a_*um0l)++y%'
# APP
STATIC_PATH = 'static'
LOG_PATH = 'logs'
LOG_HANDLER = [
logging.INFO,
logging.WARNING,
logging.ERROR
]
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(filename)s - %(funcName)s - %(lineno)s - %(message)s'
LOG_REQUEST_DETAIL = True
ON_FINISH_ASYNC = True
EXECUTOR_THREAD_MULTIPLE = 100
CORS_ALLOW_ORIGIN = ['*']
CORS_ALLOW_HEADERS = ['*']
CORS_ALLOW_METHOD = ['POST', 'GET', 'OPTIONS']
BACKEND_MD5_SALT = '8i-!yfmt+hk@-$e7%wl2hx#!v7+rjdc%s8udl0a_*um0l)++y%'
BACKEND_TOKEN_SECRET_KEY = '8i-!yfmt+hk@-$e7%wl2hx#!v7+rjdc%s8udl0a_*um0l)++y%'
class DevelopConfig(Config):
DEBUG = True
# MySQL
MYSQL_CONFIG = {
'max_connections': 100,
'stale_timeout': 300,
'host': '127.0.0.1',
'db': 'fund',
'username': 'root',
'password': 'mysql',
'port': 3306
}
# Mongodb
MONGO_CONFIG = {
'max_connections': 100,
'min_connections': 1,
'host': '127.0.0.1',
'port': 27017,
'db': 'fund',
'username': 'root',
'password': 'mongodb',
}
# Redis
REDIS_CONFIG = {
'max_connections': 100,
'min_connections': 1,
'host': '127.0.0.1',
'db': 0,
'password': 'redis',
'port': 6379
}
# MQ
MQ_CONFIG = {
'host': '127.0.0.1',
'port': 15762,
'username': 'guest',
'password': 'guest'
}
# Celery
CELERY_CONFIG = {
'timezone': "Asia/Shanghai",
'enable_utc': False,
'broker_url': 'redis://username:password@127.0.0.1:6379/0', # redis://:password@host:port/db
'result_backend': 'redis://username:password@127.0.0.1:6379/0', # amqp://user:password@host:port/myvhost
'task_serializer': 'json',
'result_serializer': 'json',
'accept_content': ['json'],
'include': [
'celerys.crontabs.fund',
'celerys.tasks.fund',
]
}
class ProductConfig(Config):
DEBUG = False
config_env = {
'dev': DevelopConfig,
'pro': ProductConfig,
}