✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Integrate a Dash app with a route into a proper running Flask environment

I’m struggling a bit with integrating a proper running Dash app inside a Flask website. Either I do have a problem in understanding howit works or it’s only a small issue.
Each hint is welcome.

  • My Flask environment has this route:
@blueprint.route('/dash-test')
@login_required
def dash_test():
    """Integrate the Dash App into the page"""
    server = flask.Flask(__name__)
    return render_template('dashapp-test.html',
                           my_dashapp=my_dash_app(),
                           server=server
                           )
  • It’s calling the function my_dash_app() which contains the Dash app:
def my_dash_app():

    app = dash.Dash(
        __name__,
        external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css'],
    )

    app.layout = html.Div(id='example-div-element')
    return app
  • Given result after send the request /dash-test:
    <dash.dash.Dash object at 0x0000025909864700>

But expected is: Dash App is shown.