Dash URL like <param>/dash

Hi, I am looking for create a dash app with a URL like this example in flask, is it possible?


I am using the first type file structure in the urls where each app is contained in a separate file. I would like to generate something like this, and pass this “tenant” param to dash app:

index_page = html.Div([






            html.Tr([html.Td(dcc.Link('Go to Page 1', href='<tenant>/apps/app1', className='alert-link'))]),

            html.Tr([html.Td(dcc.Link('Go to Page 2', href='<tenant>/apps/app2', className='alert-link'))])


    ], className='container table')


@app.callback(Output('page-content', 'children'),

              [Input('url', 'pathname')])

def display_page(pathname):

    if pathname == '<tenant>/apps/app1':

        return app1.layout
        #return app1.layout(<tenant>) ??? 

    elif pathname == '<tenant>/apps/app2':

        return app2.layout


        return index_page

Do I need to change to flask + dash? My app is totally dash. I am looking in the docs and did not find nothing like this yet.

Thanks for the help.

Does it have to be url paths? Would querystrings also be fine? So then you would do localhost:8050/?tenant=John and it would load the page for john.

from urllib.parse import urlparse, parse_qs

app.layout = html.Div([
                        dcc.Location(id='url', refresh=False),

    Output('page-layout', 'children'),
    Input('url', 'href'))
def page_load(href):
    if not href:
        return html.Div()
    name = parse_qs(urlparse(href).query)["tenant"]
    return html.Div(f"Hello {name}")