This is my first time trying dash, and I copied paste the 1.2 Layout page code to get my first Dash plot. However, after I try to make my own graph using dash with new data, the website pop up shows that " This site can’t be reached
127.0.0.1 refused to connect.". I googled online for explanations, people suggested to change the port to other numbers like “8080”. Some time it couldn’t reach the website, other times I just have the old plot shows. I am very confused about what went wrong.
import csv
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
df = pd.read_csv("topline_metrics.csv")
pv_dau = pd.pivot_table(df, index=['Country'], columns=["Platform"], values=['DAU'], aggfunc='mean', fill_value=0)
pv_tru = pd.pivot_table(df, index=['Country'], columns=["Platform"], values=['TRU'], aggfunc='mean', fill_value=0)
pv_dau
trace1 = go.Bar(x=pv_dau.index, y=pv_dau[('DAU', 'Android(All)')], name='Android_users')
trace2 = go.Bar(x=pv_tru.index, y=pv_tru[('TRU', 'Android(All)')], name='Android_users')
app = dash.Dash()
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)
app.layout = html.Div(children=[
html.H1(children='Sales Funnel Report'),
html.Div(children='''National Sales Funnel Report.'''),
dcc.Graph(
id='example-graph',
figure={
'data': [trace1, trace2],
'layout':
go.Layout(title='Order Status by Customer', barmode='stack')
})
])
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True
if __name__ == '__main__':
app.run_server(debug=True,port=8090)!