I have been attempting to create a multi-page app using the simple tutorial URL Routing and Multiple Apps and have run into an issue. I copied the code for index.py, but no matter what I do I get an IncorrectTypeException when attempting to run it.
“raise exceptions.IncorrectTypeException(
dash.exceptions.IncorrectTypeException: The input argument url.pathname
must be a list or tuple of
dash.dependencies.Input
s.”
My code is:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
from apps import history_vis_app
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])
@app.callback(Output('page-content', 'children'),Input('url', 'pathname'))
def display_page(pathname):
if pathname == '/main':
return history_vis_app.layout
elif pathname == '/apps/history_vis':
return history_vis_app.layout
else:
return '404 dude'
if __name__ == '__main__':
app.run_server(debug=True)
2 posts - 2 participants