✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

High level documentation of integrating dash with django app?

I’m sure a lot of what I’m asking is basic and assumed knowledge, but I’m new to adding interactivity to a Django project and have found what seems to be a bit of a gap in the docs, at least from the perspective of a newby.

What I’m trying to do: add a DataTable to an existing django template so that my table data can be interactive.

What I’m confused about : the relationship between a dash app.py file, the django view, and integrating the two in an existing django template.

The docs for plotly-dash assume the project is a stand-alone single page app that sources data from a .csv right in the app file, while the docs for django-plotly-dash jump right from hardcoding all the values for a chart to complex examples with callbacks and streaming data. I’m trying to find what I had assumed would be a fairly basic middleground: passing queryset data from a view to dash app for visualization.

Do I need to disregard the django view entirely and load data in the dash app? Do I need to create the app without any data in the dash app file and then merge it with the data somehow in the template, or should it happen at the view level? Should the rendered .js call the view endpoint to get the data?

TLDR: I’m just looking for a high level understanding of how this should all work in a typical use-case.

Have you already looked at django-plotly-dash — django-plotly-dash documentation ?
It offers a very good integration with Django (reuse of Django authentication, save state of apps between sessions, …)

Yes I have, thanks. I think that django-poltly-dash can probably do what I need it to, but their documentation jumps from self contained front-end-only “hello world” type apps that don’t interact with with django models at all (the radio-button example), to the specifics of complex callback setups.

What I’m currently not able to find is just a basic example of replacing, say an html table that was rendered with a traditional Django template with a DataTable. I’m sure it’s pretty basic, but I wasn’t able to find documentation get me past that knowledge gap.
Thanks.

How far have you reached?
You want to replace a whole page with a dash app showing a table? Or in a frame embedded in another page?