Python dash 服务器未更新

Abh*_*rni 1 python flask plotly-dash

我正在通过情节学习 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) 
Run Code Online (Sandbox Code Playgroud)

但是当我运行另一个示例时,我得到了上面代码的输出。

请提出前进的方向。感谢您抽出宝贵的时间。

我尝试从命令提示符运行代码,但仍然不起作用。我更改了 debug='False' 但仍然不起作用

Ale*_*xis 5

根据我对您问题的了解,您正在运行两个应用程序,并且无法可视化另一个应用程序。为此,您必须更改您正在寻找的端口:

app.run_server(debug=True,port=3004)
Run Code Online (Sandbox Code Playgroud)

这应该可以解决问题。您不能在同一端口上运行两个破折号应用程序。