Reputation: 108
I am trying to run a python Plotly dash script through terminal. The code is correct, since it was working the last time and it is not using a file from local computer. Usually when running a Plotly dash code, I would have gotten an address which was the localhost http://127.0.0.1:8050/ and the code would work fine. Now, after two months that I have not used a Plotly dash code, I cannot run any and I keep getting the same error:
Running on http://x86_64-apple-darwin13.4.0:8050/
Debugger PIN: 818-411-787
* Serving Flask app "dashfile" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
Traceback (most recent call last):
File "dashfile.py", line 390, in <module>
app.run_server(debug=True)
File "/Users/myname/opt/anaconda3/lib/python3.7/site-packages/dash/dash.py", line 1509, in run_server
self.server.run(host=host, port=port, debug=debug, **flask_run_options)
File "/Users/myname/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 990, in run
run_simple(host, port, self, **options)
File "/Users/myname/opt/anaconda3/lib/python3.7/site-packages/werkzeug/serving.py", line 1030, in run_simple
s.bind(server_address)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
So my localhost is fine and I can ping localhost easily. The problem is that I want the dash code to be run on my localhost. Not some strange address http://x86_64-apple-darwin13.4.0:8050/. At the end of the dash script there is a part:
if __name__ == '__main__':
app.run_server(debug=True)
I have tried to tell the python script in here to run on localhost but it did not work. Any ideas what I can try next?
Upvotes: 3
Views: 3220
Reputation: 349
app.run_server(debug=True,host = '127.0.0.1') is a workaround
Upvotes: 3
Reputation: 108
This worked for me: app.run_server(host='127.0.0.1', port=8050, debug=True). Trying to address to local host inside python script.
Upvotes: 2