Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

[Closed] Application Factories or creating app and/or layout on page load?

There are many reasons why one might want to create app object on load, but a very simple example is
to pre-populate Inputs, based on “current data”.
dcc.Input(id='enddate-input', type='Date', )
At the moment, default value of my ‘enddate-input’ will be populated with the date when the webserver process is started, which might be a long time ago.

Similar example: values for dropdowns, that might be linked to categorical values available in a datawarehouse.
As new entries are into DB, I’d like dropdown to automatically pick those.

Actually it is already implemented!

def build_layoyt():
    return html.Div(html.P('dynamic value: '+str( ) ))
app.layout = build_layoyt
1 Like