-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
80 lines (57 loc) · 2.03 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
# coding=utf-8
import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'wibbly wobbly timey wimey'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
POLARIS_ADMIN = os.environ.get('POLARIS_ADMIN') or 'earrow.liu@gmail.com'
POLARIS_RECORDS_PER_PAGE = 20
POLARIS_TASKS_PER_PAGE = 20
POLARIS_PROJECTS_PER_PAGE = 20
POLARIS_SERVERS_PER_PAGE = 10
@classmethod
def init_app(cls, app):
pass
class DevelopmentConfig(Config):
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
JENKINS_HOST = ''
JENKINS_USERNAME = ''
JENKINS_PASSWORD = ''
EMAIL_HOST = ''
EMAIL_SENDER = ''
EMAIL_SENDER_PASSWORD = ''
CELERY_BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERY_REDIRECT_STDOUTS_LEVEL = 'info'
CELERY_TASK_SERIALIZER = 'pickle'
CELERY_ACCEPT_CONTENT = ['pickle']
CELERYBEAT_SCHEDULE = {
'check_state': {
'task': 'app.celery_tasks.check_state',
'schedule': timedelta(seconds=300)
}
}
@classmethod
def init_app(cls, app):
Config.init_app(app)
import logging
from flask.logging import default_handler
app.logger.setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s][%(levelname)s][%(funcName)s()] %(message)s')
stream_handler.setFormatter(formatter)
app.logger.removeHandler(default_handler)
app.logger.addHandler(stream_handler)
class TestingConfig(Config):
TESTING = True
class ProductionConfig(Config):
pass
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}