Sharing data between plotly dash and django views

Viewed 91

I want to store some json data that returns from a django view in dcc.store on app startup. I'm new to django-plotly-dash. Is there any resources I can refer to solve this. Djnago View looks like this


    def renderPage(requests):
        data = load_data()
        context = {}
        context = {
            'page_data' : data
        }
        return render(requests, 'dashboard.html', context) 

Following is the code snippet of the layout


    app.layout = html.Div(
        [dcc.Location(id="url"), dcc.Store(id="page-data"), html.Div(id="page-content")],
    )

0 Answers
Related