I am trying to run the example dash application but upon trying to run, the browser says it is refusing to connect. I have checked and Google Chrome has access through the firewall.
The example code is:
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
Here is a picture of my browser:
Does anyone understand this?
First check if you are accessing the right port, the default one (usually) is 8050: http://localhost:8050/
Also, check if there is another Dash code running, it might be occupying the port.
If it does not work, try determining the host as an argument in app.runserver(args), like this:
app.run_server(host='0.0.0.0', debug=True)
You might also want to determine the port as an argument like this:
app.run_server(host='0.0.0.0', port=8050, debug=True)
Change
app.run_server(debug=True)
to
app.run_server(debug=False)
and then try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With