运行Dash应用程序时未知的名称或服务

问题描述 投票:0回答:1

我的设置非常简单,但是无法运行。我怀疑这与服务器地址有关(我认为应该是https://127.0.0.1:8050),但不知道如何更改它。任何建议高度赞赏。-设置虚拟环境并安装dash(使用pip install dash)。它也安装了flask

我对应用程序的基本设置:

import dash
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(
    html.H1(children="Hello World!")
)

if __name__ == '__main__':
    app.run_server(debug=True)

当我在终端中运行我的应用程序时,出现以下错误:

(Dash) rene@ideapad:~/Projects/Dash$ python my_app.py 
Running on http://x86_64-conda_cos6-linux-gnu:8050/
Debugger PIN: 287-942-334
 * Serving Flask app "my_app" (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 "my_app.py", line 12, in <module>
    app.run_server(debug=True)
  File "/home/rene/Environments/Dash/lib/python3.7/site-packages/dash/dash.py", line 1973, in run_server
    self.server.run(host=host, port=port, debug=debug, **flask_run_options)
  File "/home/rene/Environments/Dash/lib/python3.7/site-packages/flask/app.py", line 990, in run
    run_simple(host, port, self, **options)
  File "/home/rene/Environments/Dash/lib/python3.7/site-packages/werkzeug/serving.py", line 1030, in run_simple
    s.bind(server_address)
socket.gaierror: [Errno -2] Name or service not known
python flask plotly plotly-dash plotly-python
1个回答
0
投票

我通过手动设置主机和端口解决了该问题:

if __name__ == '__main__':
    app.run_server(host='127.0.0.1', port='8050', debug=True)

但是我仍然不知道为什么它开始使用http://x86_64-conda_cos6-linux-gnu:8050

有任何建议吗?

© www.soinside.com 2019 - 2024. All rights reserved.