Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Can I trigger a Dash function via a Flask app.route or URL?

$
0
0

Hey guys

This is probably crazy, and I probably don’t know enough about web frameworks like Flask and Django. But here goes.

Goal
I want to trigger a user-defined function in my Dash app from the browser URL or an underlying Flask app as an @app.route.

Why?
I want to display a particular view within my dash app via a hard URL, effectively like a simple API.

Example
myappdomain.com/query_string/query_year

I know in flask you can grab variables straight from the path, such as:

@app.route('/<string:query>/<int:year>')
def blah(query,year):
    #... Logic goes here
    return <call child dash app function somehow>

So I guess I’m wondering if it’s possible to somehow trigger a specific dash function/callback from the return ‘view’ of a flask route? Or if indeed this cam be done more simply from within the dash app itself?? (I dont actually need a custom flask app)

The idea would be you could redirect to display a specific state of your dash app DIRECTLY via the URL string, like an API, just as if the user had navigated there themselves.

Is this possible in any way?

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles