import dash import plotly # Custom files import DBConnector as database from callbacks import register_callbacks from layout import load_layout external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) # Set up layout in layout.py app.layout = load_layout(database.HISTORY_PERIOD_SEC, database.HISTOGRAM_PERIOD_SEC) # Set up callbacks in callbacks.py register_callbacks(app, database) if __name__ == '__main__': host = '0.0.0.0' app.run_server(debug=True, host=host)
app = dash.Dash(__name__) server = app.server app.config.suppress_callback_exceptions = True # Main layout app.title = 'Example Dashboards' app.layout = html.Div([ dcc.Location(id='url', refresh=False), html.Div(id='page-content', className='container') ]) # Routing register_routes(app) # Callbacks register_callbacks(app) # External styles with open('src/styles/external/urls.json') as external_urls: urls = json.load(external_urls) for external_url in urls['external_urls']: app.css.append_css({'external_url': external_url}) # Launch with python if __name__ == '__main__': debug = os.environ.get('DEBUG') if (os.environ.get('DEBUG') is not None) else False app.run_server(debug=debug, port=os.environ.get('APP_PORT') or 8050, host=os.environ.get('APP_HOST') or '0.0.0.0')
import dash from callbacks import register_callbacks external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) server = app.server app.config.suppress_callback_exceptions = True app.scripts.config.serve_locally = True app.title = "San Diego sequencing dashboard" sequences = format_data.load_sequences() #sequences = sequences.loc[sequences["state"]=="San Diego"] cases_whole = format_data.load_cases() #cases_whole = cases_whole.loc[cases_whole["ziptext"]!="None"] register_callbacks(app, sequences, cases_whole) app.layout = html.Div(children=[ dcc.Location(id='url', refresh=False), html.Div([dcc.Markdown(id="markdown-stuff"), html.P()]), html.Div( [html.Table(id="summary-table")], style={ "width": "30em", "marginLeft": "auto", "marginRight": "auto", "marginBottom": "20px" }), html.Div([ html.Div([
import flask import layout from dotenv import load_dotenv # flask server for production environment server = flask.Flask(__name__) # load environment variables load_dotenv() # app initialize dashapp = dash.Dash( __name__, external_stylesheets=[ "assets/css/bootstrap.css", "assets/css/fontawesome.css" ], # these meta_tags ensure content is scaled correctly on different devices # see: https://www.w3schools.com/css/css_rwd_viewport.asp for more meta_tags=[{ "name": "viewport", "content": "width=device-width, initial-scale=1" }], url_base_pathname='/getraenke/', server=server) # register layout dashapp.layout = layout.serve_layout() # register callbacks callbacks.register_callbacks(dashapp)
# figure=fig_kmeans_scatter, ) ], className="six columns"), html.Div([html.Img(id='kmeans-picture-LIVE')], className="six columns"), ], className="row")) #%% Kmeans Image and Scatter STATIC if 0: DOM.append(html.H3("(Static demo)")) DOM.append( html.Div([ html.Div(children=[dcc.Graph(figure=fig_kmeans_scatter, )], className="six columns"), html.Div([ html_kmeans_img_STATIC, ], className="six columns"), ], className="row")) #%% Build the Layout, given the DOM as a list app.layout = html.Div(children=DOM + [], className="container-wide") # Register all callbacks, pass in state register_callbacks(app, df_test, df_by_image, img_zip, Image) if __name__ == '__main__': app.run_server(debug=True)
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-178463864-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-178463864-1'); </script> {%metas%} <title>{%title%}</title> {%favicon%} {%css%} </head> <body> {%app_entry%} <footer> {%config%} {%scripts%} {%renderer%} </footer> </body> </html> ''' print_function = False register_callbacks(app, print_function) register_routes(app) if __name__ == '__main__': app.run_server(debug=True)
[Input('url', 'href')]) def page_load(href): """ Upon page load, take the url, parse the querystring, and use the resulting state dictionary to build up the layout. """ if not href: return [] state = parse_state(href) return build_layout(state) @app.callback(Output('url', 'search'), inputs=[Input(id, param) for (id, param) in component_ids]) def update_url_state(*values): """ When any of the (id, param) values changes, this callback gets triggered. Passes the list of component id's, the list of component parameters (zipped together in component_ids_zipped), and the value to encode_state() and return a properly formed querystring. """ return encode_state(component_ids_zipped, values) callbacks.register_callbacks(app) application = app.server if __name__ == '__main__': app.run_server(debug=True)