Black Lives Matter. Please consider donating to Black Girls Code today.

Deploying multiple apps

Hi,

I’ve read up on serving single apps, but what if I have 5+? The only thing I can think of is using multi pages and lots of conditional imports to serve each, but I’d rather keep them separate. Ideally:

server/app1
server/app2
server/app3

These Dash apps are only for staff, so I’m not worried about load that much. Curious to know other people’s experiences.

Thanks

Will

1 Like

Didn’t search hard enough: Multiple Dashboards?

See https://plot.ly/dash/urls for multi-page apps as well.

1 Like

as i understand those examples shows multiple-static-dashboards. is anywhere example of multipage app where each page is live-updateable by page refresh?

This is actually inherent in the examples. Multi-page apps in Dash work by updating the children attribute of a container div inside a callback function that responds to changes in the pathname of the url (dcc.Location). Since this is a callback function, you can return data that is static or that is computed during runtime in the callback itself.

Here’s a simple example (adapted from https://plot.ly/dash/urls)

app.layout = html.Div([
    # represents the URL bar, doesn't render anything
    dcc.Location(id='url', refresh=False),

    dcc.Link('Navigate to "/"', href='/'),
    html.Br(),
    dcc.Link('Navigate to "/page-2"', href='/page-2'),

    # content will be rendered in this element
    html.Div(id='page-content')
])


@app.callback(dash.dependencies.Output('page-content', 'children'),
              [dash.dependencies.Input('url', 'pathname')])
def display_page(pathname):
    return html.Div([
        html.H3('You are on page {} and the current time is {}'.format(
            pathname, datetime.datetime.now()))
    ])
```

Thank you! Dash is amazing - it reduces the user’s programming skill level ,but application quality is still high. Before Dash i cant imagine that i can do sexy-looking web-app in just few days with only codecademy python course,this forum and google for information :grimacing:.

1 Like

HI again! I’m not sure, but maybe i found a bug with dt.DataTable - looks like Dash cant render it in multipage app and no errors on console. i tried modification of multipage-app when pages are in separate files. i got download it on cloud https://yadi.sk/d/TSfzfUde3NSQtr
there are :
app1 without dt.DataTable
app2 same+ table
app3 is same as app2 but is singlepage app - to make sure that table can be rendered.

Ah yeah, this is annoying. See Display tables in Dash for an interim solution.

1 Like