-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
executable file
·61 lines (42 loc) · 1.59 KB
/
start.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
from flask import Flask, current_app
import logging
import os
import sys
import json
from kafka import KafkaConsumer, TopicPartition
from threading import Thread
root = logging.getLogger()
root.setLevel(logging.getLevelName(os.environ.get("LOG_LEVEL", "INFO")))
logging.getLogger('kafka').setLevel(logging.INFO)
logging.getLogger('engineio').setLevel(logging.WARN)
logging.getLogger('flask_authnz').setLevel(logging.WARN)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
root.addHandler(ch)
logger = logging.getLogger(__name__)
from context import app, security
from pages import pages_blueprint
from services.explgbk import explgbk_blueprint
from flask_socket_util import socket_service
import dal.exp_cache
__author__ = '[email protected]'
# Initialize application.
app = Flask("explgbk")
# Set the expiration for static files
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 60*60;
app.secret_key = "This is a secret key that is somewhat temporary."
app.debug = False
@app.template_filter('json')
def jinga2_jsonfilter(value):
return json.dumps(value)
# Register routes.
app.register_blueprint(pages_blueprint)
app.register_blueprint(explgbk_blueprint)
socket_service.init_app(app, security, kafkatopics = ["experiments", "elog", "runs", "shifts", "samples", "file_catalog", "workflow_jobs"])
dal.exp_cache.init_app(app)
logger.info("Server initialization complete")
if __name__ == '__main__':
print("Please use gunicorn for development as well.")
sys.exit(-1)