Plotly Dash-based broker app for the TOM Toolkit
Project description
tom_alerts_dash
This module supplements the tom_alerts
module with Plotly Dash support for more responsive broker views.
Installation
Install the module into your TOM environment:
pip install tom-alerts-dash
Add tom_alerts_dash
and django_plotly_dash.apps.DjangoPlotlyDashConfig
to the INSTALLED_APPS
in your TOM's settings.py
:
INSTALLED_APPS = [
'django.contrib.admin',
...
'tom_dataproducts',
'tom_alerts_dash',
'django_plotly_dash.apps.DjangoPlotlyDashConfig'
]
Add STATIC_ROOT = os.path.join(BASE_DIR, '_static')
and the following STATICFILES_FINDERS
configuration to your settings.py
, ideally in the Static files (CSS, JavaScript, Images)
section:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '_static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'data')
MEDIA_URL = '/data/'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django_plotly_dash.finders.DashAssetFinder',
'django_plotly_dash.finders.DashComponentFinder',
'django_plotly_dash.finders.DashAppDirectoryFinder',
]
Add django_plotly_dash.middleware.BaseMiddleware
to MIDDLEWARE
in your settings.py
:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
...
'django_plotly_dash.middleware.BaseMiddleware',
'tom_common.middleware.Raise403Middleware',
...
]
Add the following Django Plotly Dash configuration to your settings.py
:
# django-plotly-dash configuration
X_FRAME_OPTIONS = 'SAMEORIGIN'
PLOTLY_COMPONENTS = [
# Common components
'dash_core_components',
'dash_html_components',
'dash_renderer',
# django-plotly-dash components
'dpd_components',
# static support if serving local assets
# 'dpd_static_support',
# Other components, as needed
'dash_bootstrap_components',
'dash_table'
]
Finally, add the following two new paths to your base urls.py
:
url_patterns = [
path('alerts/', include('tom_alerts_dash.urls', namespace='tom_alerts_dash')),
path('', include('tom_common.urls')),
path('django_plotly_dash/', include('django_plotly_dash.urls')),
]
Please note that the path with the namespace tom_alerts_dash
MUST be placed above the tom_common.urls
in order to properly override the default tom_alerts
paths.
Creating a custom Dash broker module
For information on writing your own Dash broker module, please see the TOM Toolkit documentation on Dash broker modules.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tom_alerts_dash-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c23f0767a0a0fd696d8e466024337093d527b025110335dba0c1a3e41881bc36 |
|
MD5 | 41020e900beb0635ef0cb2c3fd218c1f |
|
BLAKE2b-256 | bcc8b655bb32139a087041803597f538dacc1a4510c122131aa7dbc567c16223 |