Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Saving data in multi-page app to a file

Hi,

If I have a file structure similar to the one specified in the “Multi-Page Apps and URL Support”:

- app.py
- index.py
- apps
   |-- app1.py
   |-- app2.py

And I want to save data contained in each of the “apps” to one file using dcc.Download. What would be the best way to do this?

PS

I already tried putting dcc.stores for each input in index.py and then using callbacks to update the dcc.stores w/in app1.py and app2.py. However, only the data on the same page is saved. For example, if I’m in app2, only the app2 data will be saved and not the app1 data- the dash.callback.context message will say that the dcc.stores for app1 have nothing in them.

I also tried the hidden-div method, however, my URL routing stopped working

Hi, create dcc.Store in main layout and use it from there. Main layout is when you combine app1/app2 layouts together.

Hi, thanks for the response. By main layout, you mean app.layout that’s in index.py, right? If so, then I already put the dcc.stores in there. And with your second sentence, are you saying that I should put the app1 and app2 layouts in the app.layout?

Thanks!

If you need to store a lot of data , but that data can be structured as key-value pairs (KVPs), localStorage might be good enough for your needs.

Thanks for the informaiton.