I’ve got a multipage app that isn’t updating upon refresh. I’ve recreated a very basic example.
index.py →
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from test_page import overviewLayout
from app import app
def serve_layout():
tmpLayout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='main-content1')])
return tmpLayout
app.config.suppress_callback_exceptions= True
app.layout = serve_layout
@app.callback(Output('main-content1', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
if pathname=='/':
return overviewLayout
else:
return html.H3('COMING SOON')
if __name__ == '__main__':
app.run_server(debug=False,port=8051,host=('0.0.0.0'))
app.py->
app = dash.Dash(
__name__)
server = app.server
test_page.py →
overviewLayout = [
html.H1('The time is: ' + str(datetime.datetime.now()))
]