What's the differene between writing this:
app = dash.Dash(__name__, suppress_callback_exceptions=True,
meta_tags=[{'name': 'viewport',
'content': 'width=device-width, initial-scale=1.0'}]
)
server = app.server
and this :
app = dash.Dash(__name__, suppress_callback_exceptions=False,
meta_tags=[{'name': 'viewport',
'content': 'width=device-width, initial-scale=1.0'}]
)
server = app.server
From the source code:
suppress_callback_exceptions: check callbacks to ensure referenced IDs exist and props are valid. Set to
True
if your layout is dynamic, to bypass these checks.
So there isn't really a difference in the examples you linked on their own. Or rather you would only experience different behavior if app
has callbacks that refer to non-existing ids and/or invalid props or if elements in app.layout
have invalid props.
A reason to set suppress_callback_exceptions
to True
could be because you have callbacks that refer to elements by id, but these elements are not always present in the layout during the lifecycle of the app. The elements might be dynamically inserted into app.layout
by a different callback for example.
Another example from the documentation
...Since suppress_callback_exceptions=True is specified here, Dash has to assume that the input is present in the app layout when the app is initialized...