Python dash 服务器未更新
Python dash server not updating
我正在通过 plotly 学习 dash 的基础知识。以下代码运行良好。
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Input(id='input', value='Enter something here!', type='text'),
html.Div(id='output')
])
@app.callback(
Output(component_id='output', component_property='children'),
[Input(component_id='input', component_property='value')]
)
def update_value(input_data):
return 'Input: "{}"'.format(input_data)
if __name__ == '__main__':
app.run_server(debug=True)
但是当我 运行 另一个例子时,我得到上面代码的输出。
请提出前进的方向。
感谢您的宝贵时间。
我尝试 运行从命令提示符输入代码,但仍然没有用。
我改了 debug='False' 但还是不行
根据我对您问题的了解,您运行正在使用两个应用程序,而您无法查看另一个应用程序。
那么,您必须更改要查找的端口:
app.run_server(debug=True,port=3004)
这应该可以解决问题。您不能 运行 同一端口上的两个 dash 应用程序。
我正在通过 plotly 学习 dash 的基础知识。以下代码运行良好。
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Input(id='input', value='Enter something here!', type='text'),
html.Div(id='output')
])
@app.callback(
Output(component_id='output', component_property='children'),
[Input(component_id='input', component_property='value')]
)
def update_value(input_data):
return 'Input: "{}"'.format(input_data)
if __name__ == '__main__':
app.run_server(debug=True)
但是当我 运行 另一个例子时,我得到上面代码的输出。
请提出前进的方向。 感谢您的宝贵时间。
我尝试 运行从命令提示符输入代码,但仍然没有用。 我改了 debug='False' 但还是不行
根据我对您问题的了解,您运行正在使用两个应用程序,而您无法查看另一个应用程序。 那么,您必须更改要查找的端口:
app.run_server(debug=True,port=3004)
这应该可以解决问题。您不能 运行 同一端口上的两个 dash 应用程序。