Quantcast
Channel: ЁЯОЫя╕П Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271
тЖз

How to reload data every time page is reloaded when app is passed as parameter?

$
0
0

If you want to reload layout every page reload you do this:
app.layout = myfunction

NOTE: calling my function without parenthesis, this would be wrong:
app.layout = myfunction()

But what if I want to call that function with parameters?
app.layout = myfunction????

IтАЩve made a workaround by creating a dummy function like this

def serve_layout():
    return layout(app) # I pass app to use app.callbacks

app.layout = serve_layout

HOWEVER, I am getting lots of errors about callbacks telling me that there are duplicate callbacks, which there really arenтАЩt.

ERROR:

In the callback for output(s):
  information-container.style
Output 0 (information-container.style) is already in use.
Any given output can only have one callback that sets it.
To resolve this situation, try combining these into
one callback function, distinguishing the trigger
by using `dash.callback_context` if necessary.

source code:


import dash
from layout import layout # layout is where i define all layout logic/ components

def serve_layout():
    return layout(app)

app = dash.Dash(__name__)

app.layout = serve_layout
app.title = 'Example app'
if __name__ == "__main__":
    app.run_server(debug=True,
                   host='0.0.0.0')

2 posts - 1 participant

Read full topic

тЖз

Viewing all articles
Browse latest Browse all 6271

Trending Articles