# Mulitple Pages - problem with the example on https://dash.plotly.com/urls

**URL:** <https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878>\
**Category:** Dash Python\
**Created:** [January 7, 2022, 10:09am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878 "2022-01-07T10:09:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://community.plotly.com/u/Torsten)\
**Post date:** [January 7, 2022, 10:09am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878/1 "2022-01-07T10:09:15Z")

</div>

Hi all,

I have try the example “Structuring a Multi-Page App” on [this Page](https://dash.plotly.com/urls) because I like a Structure :-).  
I have structured the following Files:  
app.py  
callbacks.py  
index.py  
layouts.py  
/apps/app1.py  
/apps/app2.py

When I start “index.py” and open “127.0.0.1:8050” I get only a **404**!

What is the Problem here?

BR  
Torsten

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [January 7, 2022, 10:23am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878/2 "2022-01-07T10:23:47Z")

</div>

Hi @Torsten,

Could you share with us your `index.py` file, especially the callback having as input `dcc.Location`?

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://community.plotly.com/u/Torsten)\
**Post date:** [January 7, 2022, 10:40am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878/3 "2022-01-07T10:40:50Z")

</div>

Here the index.py:

```auto

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 app1, app2

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 == '/apps/app1':
        return app1.layout
    elif pathname == '/apps/app2':
        return app2.layout
    else:
        return '404'

if __name__ == ' __main__':
    app.run_server(debug=False)

```

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [January 7, 2022, 10:48am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878/4 "2022-01-07T10:48:39Z")

</div>

Ok. When you open 127.0.0.1:8050, the `pathname` is “/”, which is not handled in any of if statements, therefore it returns 404.

Without any changes in the app, you should be able to open 127.0.0.1:8050/apps/app1 for example. This is handled in the callback.

Usually it is a good idea to have an index page layout with links to the different apps with `pathname == "/"`.

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://community.plotly.com/u/Torsten)\
**Post date:** [January 7, 2022, 10:55am UTC](https://community.plotly.com/t/mulitple-pages-problem-with-the-example-on-https-dash-plotly-com-urls/59878/5 "2022-01-07T10:55:26Z")

</div>

Ok, it works 🙂  
I will insert an index-page as Start-Page.

Thank’s a lot
