Dash multipage app does not work


I am trying to replicate dash multipage app from documentation page Multi-Page Apps and URL Support | Dash for Python Documentation | Plotly but it does not work.

Sounds strange that app from tutorial does not work…

Please find git repo with my code GitHub - milanzmitrovic/dash-multi-page-not-working .

I am confused, why it does not work?

I am using Dash 2.3.1 version.

Problem is present when app is organised in multiple files. On the other hand, when app is organised in one file, then it works perfectly. I can’t figure out what is issue with importing page layout…

Python 3.7.0


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:


Thank you @AnnMarieW . Link that you provided is excellent, I will definitely give it a try!

Btw, regarding my issue, it just started working after two hours. I do not know why and how, it was probably sth related with my Mac. Btw I was manually changing URL address in browser (in all pages were error 404), but it didn’t work.

Milan M

1 Like