简体   繁体   中英

Python dash server not updating

I am learning the basics of dash by plotly. The following code works well.

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) 

But when I run another example, I get output for the code above.

Please suggest a way forward. Thanks for your valuable time.

I tried running the code from the command prompt but still didn't work. I changed debug='False' but still didn't work

From what i've been understanding of your problem, you are running two apps and you can't visualze the other app. Well to do so you have to change the port you are looking for:

app.run_server(debug=True,port=3004)

This should do the trick. You can't run two dash app on the same port.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM