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

Pass variable from flask page to dash page

I am getting error when calling a dash page from flask page using url_for:
werkzeug.routing.BuildError: Could not build url for endpoint ‘/app/MyDashApps’ with values [‘description’]. Did you mean ‘/app/_dash-routes’ instead?

Is there a way to pass a variable from flask to dash along with the url?

route.py is:
@AppServer.route(’/visualization/’, methods=[‘GET’, ‘POST’])
def visualization(description):
return redirect(url_for(’/app/MyDashApps’, description=description))

DashServer.layout = html.Div([ dcc.Location(id=‘url’, refresh=False), dcc.Input(id=‘description’, type=‘text’),
html.Div(id=‘page-content’) ])

@DashServer.callback(Output(‘page-content’, ‘children’),[Input(‘url’, ‘pathname’)])
def display_page(pathname):
if pathname == ‘/app/MyDashApps’:
return dashapp1.layout

3 Likes

I’m wondering the same thing, does anyone has an answer to this question ?

Thanks

I am also going through the same issue. Has anyone came up with a solution.

Hello I have a similar issue. I have a flask app that I can capture data from an html row click. I want to send that data to my dash route , how can I send into dash when I call that route?

my dash app call looks like this:

app = dash.Dash(name, server=server, url_base_pathname=’/dashapp’)

Is there a way to add parameters to the call? i.e strval=id where id was from the click event in the html table?

app = dash.Dash(name, server=server, url_base_pathname=’/dashapp’, strval=id)