app_setup module¶
- app_setup(port, service_prefix=None, stylesheet='darkly', enable_logging=True, logging_level='info', log_to_file=False)¶
Set up and configure a Dash application with the specified parameters.
- Parameters:
port (int) – The port number for the Dash application.
service_prefix (str) – The service prefix used for constructing the app’s pathname.
stylesheet (str) – The name of the Bootstrap theme to apply to the app. Must be a key in theme_map.
enable_logging (bool) – Decides if ssb_dash_framework logging should be used. Defaults to True.
logging_level (str) – The logging level set for the application logging. Valid values are “debug”, “info”, “warning”, “error”, or “critical”.
log_to_file (bool) – Decides if log should be written to file ‘work/app.log’ in addition to the console.
- Returns:
Configured Dash application instance.
- Return type:
Dash
Notes
The function maps the stylesheet parameter to a Bootstrap theme using theme_map.
A callback is registered within the app to toggle the visibility of an element with the ID main-varvelger based on the number of clicks on sidebar-varvelger-button.
Examples
>>> import os >>> app = app_setup(port=8050, service_prefix=os.getenv("JUPYTERHUB_SERVICE_PREFIX", "/")) >>> app.run_server()