0
0
Fork 0
mirror of https://github.com/alerta/alerta.git synced 2025-02-23 21:27:57 +00:00
alerta_alerta/alerta/app/__init__.py

37 lines
816 B
Python
Raw Normal View History

2013-04-02 13:48:55 +00:00
2014-09-23 19:48:13 +00:00
import os
2014-07-27 17:54:49 +00:00
import logging
2013-02-19 10:57:05 +00:00
2014-07-27 17:54:49 +00:00
from flask import Flask
2013-03-15 17:18:39 +00:00
2014-10-18 22:15:18 +00:00
LOG_FORMAT = '%(asctime)s - %(name)s[%(process)d]: %(levelname)s - %(message)s'
2013-02-17 23:56:52 +00:00
app = Flask(__name__)
2014-08-12 23:58:08 +00:00
app.config.from_object('alerta.settings')
app.config.from_pyfile('/etc/alertad.conf', silent=True)
2014-08-19 22:10:13 +00:00
app.config.from_envvar('ALERTA_SVR_CONF_FILE', silent=True)
2014-07-27 17:54:49 +00:00
2014-09-23 19:48:13 +00:00
if 'SECRET_KEY' in os.environ:
app.config['SECRET_KEY'] = os.environ['SECRET_KEY']
2014-10-18 22:15:18 +00:00
if app.debug:
app.debug_log_format = LOG_FORMAT
else:
2014-10-18 21:09:20 +00:00
stderr_handler = logging.StreamHandler()
2014-10-18 22:15:18 +00:00
stderr_handler.setFormatter(logging.Formatter(LOG_FORMAT))
2014-10-18 21:09:20 +00:00
app.logger.addHandler(stderr_handler)
2014-10-18 19:48:56 +00:00
app.logger.setLevel(logging.INFO)
2014-07-27 17:54:49 +00:00
2014-10-11 22:55:19 +00:00
from alerta.app.database import Mongo
db = Mongo()
2013-02-17 23:56:52 +00:00
import views
2014-12-16 12:01:37 +00:00
import webhooks.views
2013-02-17 23:56:52 +00:00
import management.views
def main():
app.run(host='0.0.0.0', port=8080)