Dash multipage app does not work

Hi @Milan

The app is working - it starts by displaying “404” since there is no routing for a home page "/".

You could add this to your callback in app.py:

elif pathname == '/':
        return page1.layout	

Another solution is to add some links to the app.layout

Note also that you have a typo in the href in page2.py

dcc.Link('Go to Page 1', href='/page2')

should be:

dcc.Link('Go to Page 1', href='/page1')

If you would like to check out a new, easier way to make multi-page apps, see this forum post: 📣 Introducing Dash `/pages` - A Dash 2.x Feature Preview
and demo:
https://dashlabs.pythonanywhere.com/

2 Likes