i have dash.py file in which i have created a dash which includes some graphs and data table.
how can i embed this dash.py file into a pre-existing django app.
(like i have a django-dashboard created, i need to add a statistics button in the django dashboard and when clicked on it my dash.py file should and and execute the graphs created using dash.
can u please help me out in this?)
If you’re going to run your dash app inside django, then take a look at django-plotly-dash.
If however you’re going to run a separate server, then embedding in an
<iframe> is probably the cleanest way.
@Sam2 - if you want to use Django to also serve up the dash app then look at
django-plotly-dash in the link above. It provides a template tag for embedding Dash apps in an
iframe along with other necessary infrastructure.
On the other hand, if you just want to refer to a Dash app served elsewhere, then put the url into an
iframe element in a Django template - something along the lines of
<iframe (various parameters like height etc) src="https://dash_server_url"></iframe>
Note that this is a general Django use case, and there is nothing Dash specific in it. The
dash_server_url must be accessible to the client.
Thank you! I got it @delsim
Hi delsim, I tried to use your django-plotly-dash to embed the newly released dash component called dash-pivottable into my django project, but in the sample snippet of the component, a sever for the app is defined by “server=app.server”, which will raise an error of “AttributeError: ‘DjangoDash’ object has no attribute ‘server’”. If I comment out that line, there’s no error but the dash component is unable to be loaded and nothing displayed. So I want to try the “iframe” way, but I don’t understand where I can get the “https://dash_server_url” for the dash-pivottable component. You can find the dash-pivottable component here: “📣 Dash Pivottable Released”