import datetime
import dash
from dash import html
def serve_layout():
return html.H1('The time is: ' + str(datetime.datetime.now()))
app.layout = serve_layout
if __name__ == '__main__':
app.run_server(debug=True)
Note : Heads up! You need to write app.layout = serve_layout not app.layout = serve_layout(). That is, define app.layout to the actual function instance.
Code Example
Note : Heads up! You need to write
app.layout = serve_layout
notapp.layout = serve_layout()
. That is, defineapp.layout
to the actual function instance.Reference
https://dash.plotly.com/live-updates