4

I want to create a dashboard using Plotly's dash framework on flask framework integration. Where I want to add token-based user authentication in the flask. after successful authentication, dash app attached to flask and display on browser route.

from flask import Flask, redirect
from dash import Dash
import dash_html_components as html
import dash_core_components as dcc

server = Flask(__name__)

app = Dash(__name__, server=server, url_base_pathname='/dashboard/')

@app.server.route('/')
def index():
    return "hello"

@app.server.route("/dashboard/")
@app_auth  # the authentication decorator 
def layout(data):
    if data['isAuthentication']:
        app.layout = html.Div([html.Div("welcome in dash app")])
        return app.layout

if __name__=="__main__":
    app.server.run()

But this is not working

blong
  • 2,815
  • 8
  • 44
  • 110
Amar Kumar
  • 43
  • 5

0 Answers0