-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm_visual_app.py
66 lines (50 loc) · 1.93 KB
/
m_visual_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
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
# Standard library imports
import logging
# Related third party imports
from flask import Flask
import dash
import dash_bootstrap_components as dbc
from dash import html
# Local application/library specific imports
from z_handy_modules import COLORS
from m_visual_server import setup_auth, load_configuration
from m_visual_callbacks import register_callbacks, setup_clientside_callback
from m_visualization_divs import create_widget, create_news_div, create_layout_div
from m_visualization_side import create_progress_bar
from m_visual_figures import (create_trade_details_div,
create_loading_component, create_log_output,
create_figure_div, create_first_graph)
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
# Create Flask and Dash instances
server = Flask(__name__)
server.secret_key = load_configuration()
app = dash.Dash(__name__, server=server, url_base_pathname='/', external_stylesheets=[
dbc.themes.BOOTSTRAP, 'https://use.fontawesome.com/releases/v5.8.1/css/all.css'])
# Setup authentication
setup_auth(app, server)
# Register callbacks
register_callbacks(app)
def create_layout():
app.layout = html.Div(
style={'backgroundColor': COLORS['background'], 'color': COLORS['white']},
children=[
create_progress_bar(),
create_loading_component(),
html.Div(id='dummy-output', style={'display': 'none'}),
create_first_graph(),
create_layout_div(),
create_log_output(),
create_trade_details_div(),
*create_widget(),
html.Div(id='news-div', children=[create_news_div()]),
create_figure_div()
]
)
# Setup clientside callback and run server
setup_clientside_callback(app)
app.run_server(host='0.0.0.0', port=8051, debug=False)
def visualize_charts():
create_layout()
if __name__ == '__main__':
visualize_charts()