amazon-web-services - 为什么 Dash 应用程序无法在 AWS Cloud9 中预览?
问题描述
尝试在 AWS Cloud9 中查看 Dash 应用程序。在 Cloud9 文档 ( https://docs.c9.io/docs/run-an-application ) 中,IP 需要为 0.0.0.0,并且唯一开放的端口是 8000、8001 和 8002。
在 run_server 函数中设置这些端口,并尝试将 adhoc ssl 与 pyopenssl 一起使用,但无济于事。
我正在从终端的 python 3.6 虚拟环境中运行该文件。
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': 'Montreal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(host='0.0.0.0', port=8000)
我仍然无法在 Cloud9 的预览窗格中查看 Dash 应用程序。
有谁知道这个问题的解决方案?
解决方案
AWS Cloud9 的预览端口不同:8080、8081、8082。
有关更多信息,请参阅此文档 https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html
推荐阅读
- python - 使用单击时主函数的命令行参数
- java - Android:设备升级到 Android 9 后无法从 Android Studio 启动应用程序
- ios - 无法传递对指定 self 的协议的引用
- python - 如何制作一个输出具有预定义大小的数组的函数?
- flutter - 当状态代码在单独的文件中定义时,Listview 未显示
- python - 您如何使用数据框获得里程总和?
- java - 忽略某些条件的循环队列 toString 方法
- mysql - 内部连接条件还是在哪里使用?
- bash - Automator - 处理从 Applescript 传递到 Shell Script 的路径上的空格
- mysql - 为什么 WordPress 将 NOT NULL 日期时间列默认为 0000-00-00 00:00:00?