运行 一个 Dash 应用时名称或服务未知
Name or service not known when running a Dash app
我的设置非常简单,但无法 运行。我怀疑它与服务器地址有关(我认为它应该是 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
我通过手动设置主机和端口解决了这个问题:
if __name__ == '__main__':
app.run_server(host='127.0.0.1', port='8050', debug=True)
但我仍然不知道为什么它开始使用 http://x86_64-conda_cos6-linux-gnu:8050
。
有什么建议吗?
我的设置非常简单,但无法 运行。我怀疑它与服务器地址有关(我认为它应该是 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
我通过手动设置主机和端口解决了这个问题:
if __name__ == '__main__':
app.run_server(host='127.0.0.1', port='8050', debug=True)
但我仍然不知道为什么它开始使用 http://x86_64-conda_cos6-linux-gnu:8050
。
有什么建议吗?