same problem.
’
import dash
import dash_auth
import dash_core_components as dcc
import dash_html_components as html
import plotly
#we need to keep usernames in a file or database
#source code repository.
VALID_USERNAME_PASSWORD_PAIRS = {
‘hello’: ‘world’
}
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = dash.Dash(name,external_stylesheets = external_stylesheets)
auth = dash_auth.BasicAuth(
app,
VALID_USERNAME_PASSWORD_PAIRS
)
app.layout = html.Div([
html.H1(‘Welcome to the app’),
html.H3(‘You are successfully authorized’),
dcc.Dropdown(
id = ‘dropdown’,
options = [{‘label’:i,‘value’:i} for i in [‘A’,‘B’]],
value = ‘A’
),
dcc.Graph(id=‘graph’)
],className = ‘container’)
@app.callback(
dash.dependencies.Output(‘graph’,‘figure’),
[dash.dependencies.Input(‘dropdown’,‘value’)])
def update_graph(dropdown_value):
return{
‘layout’ : {
‘title’ : ‘Graph of {}’.format(dropdown_value),
‘margin’ : {
‘l’ : 20,
‘b’ : 20,
‘r’ : 10,
‘t’ : 60
}
},
‘data’ : [{‘x’ : [1,2,3], ‘y’ : [4,1,2]}]
}
if name == ‘main’:
app.run_server(debug = True)’