-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
27 lines (23 loc) · 915 Bytes
/
app.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
import re
import logging
from snueue import app
DEBUG_LOG_FORMAT = (
'%(message)s'
)
if __name__ == '__main__':
config_object = 'snueue.config.development'
app.config.from_object(config_object)
app.logger.addHandler(app.config.get('LOGGING_HANDLER'))
app.logger.handlers[0].setFormatter(logging.Formatter(DEBUG_LOG_FORMAT))
app.logger.info(" * App initialized in with config {}".format(config_object))
app.run(host=app.config.get('HOST'))
else:
config_object = 'snueue.config.production'
app.config.from_object(config_object)
stream_handler = app.config.get('LOGGING_HANDLER')
app.logger.addHandler(stream_handler)
app.logger.setLevel(logging.INFO)
mail_handler = app.config.get('LOGGING_MAIL_HANDLER')
if mail_handler is not None:
app.logger.addHandler(mail_handler)
app.logger.info("App initialized in with config {}".format(config_object))