We were wondering if there was some way to grab the URL before serving the Dash app layout. We are currently setting app.layout to a function (as seen in your tutorial here: https://plot.ly/dash/live-updates), but need this URL to update a component within the layout.
# We need to grab the URL here to update a component below # We tried url_string = request.url here, but failed (see below) return html.Div([ ... ])
app.layout = serve_layout()
Ideally, we would use the dcc.Location component to grab the URL through ‘pathname,’ however, this component is not initialized yet. We thought to use Flask’s request.url function, but this is not accessible from this function (error: RuntimeError: Working outside of request context.). How can we access the request? Or any other ideas to get this URL?