forked from one-love/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
71 lines (57 loc) · 2.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
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
from datetime import timedelta
from onelove.plugin import load_hosting_providers, load_knowledge_sources
from plugins import HOSTING_PROVIDERS, KNOWLEDGE_SOURCES
import os
BACKEND_PATH = os.path.dirname(os.path.abspath(__file__))
BACKEND_APP = os.path.basename(BACKEND_PATH)
try:
from local_config import BaseConfig
except ImportError:
class BaseConfig(object):
SECRET_KEY = 'top-secret'
class Config(BaseConfig):
DEBUG = False
JWT_EXPIRATION_DELTA = timedelta(days=7)
KNOWLEDGE_SOURCES = load_knowledge_sources(KNOWLEDGE_SOURCES)
MONGODB_DB = 'onelove'
PROVIDERS = load_hosting_providers(HOSTING_PROVIDERS)
SECURITY_LOGIN_USER_TEMPLATE = 'security/login.html'
SECURITY_PASSWORD_HASH = 'sha512_crypt'
SECURITY_PASSWORD_SALT = 'COmwUar8X1s4NrNN'
SECURITY_SEND_REGISTER_EMAIL = False
SECURITY_URL_PREFIX = "/admin"
@staticmethod
def init_app(app):
pass
class DevConfig(Config):
DEBUG = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
ONELOVE_MAIL_SUBJECT_PREFIX = '[OneLove] '
ONELOVE_MAIL_SENDER = 'OneLove Admin <[email protected]>'
DEBUG_TB_PROFILER_ENABLED = True
DEBUG_TB_PANELS = [
'flask_debugtoolbar.panels.versions.VersionDebugPanel',
'flask_debugtoolbar.panels.timer.TimerDebugPanel',
'flask_debugtoolbar.panels.headers.HeaderDebugPanel',
'flask_debugtoolbar.panels.request_vars.RequestVarsDebugPanel',
'flask_debugtoolbar.panels.template.TemplateDebugPanel',
'flask_debugtoolbar.panels.logger.LoggingPanel',
'flask_debugtoolbar.panels.profiler.ProfilerDebugPanel',
'flask.ext.mongoengine.panels.MongoDebugPanel',
'flask_debug_api.BrowseAPIPanel'
]
class TestConfig(Config):
TESTING = True
MONGODB_DB = 'test'
class ProdConfig(Config):
pass
configs = {
'dev': DevConfig,
'testing': TestConfig,
'prod': ProdConfig,
'default': ProdConfig
}