I have set up a multi-page Dash application following the fantastic Dash documentation.
However, whenever I refresh the application on a page that is not the homepage, the Dash application will automatically route me back to the homepage:
In this gif, I navigated the application to another page compare_clusters
using a tab component. However, when I refresh the page, it goes back to find_clusters
. What could be wrong here?
The routing section is in index.py
:
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/' or pathname == '/pages/find_clusters':
return find_clusters.layout
elif pathname == '/pages/compare_clusters':
return compare_clusters.layout
else:
return '404'
I am using Dash v1.12.0 with Python 3.