-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (26 loc) · 840 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
28
29
30
31
32
import logging
import json
from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
@app.route('/health_check', methods=['GET'])
def health_check():
'''
health_check
'''
app.logger.info("health_check")
response = {'status': 'OK'}
return jsonify(response), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5002, debug=True, ssl_context=('cert.pem', 'key.pem'))
else:
# setup logging using gunicorn logger
formatter = logging.Formatter(
'[%(asctime)s.%(msecs)03d] [%(name)s] [%(levelname)s] - %(message)s',
'%d-%m-%Y %H:%M:%S'
)
gunicorn_logger = logging.getLogger('gunicorn.error')
app.logger.handlers = gunicorn_logger.handlers
app.logger.handlers[0].setFormatter(formatter)
app.logger.setLevel(logging.DEBUG)