How to save huge data by session in server with django_dash_plotly? (flask-caching does not work)

Hi all,

I now developed Dash-app using flask-caching to less DB access and make response faster. It works well.
But AttributeError was raised when I tried to integrate the Dash-app with already existing Django-project using django_dash_plotly like below.
Do you have any idea to solve it? I would like to save huge computed data by session on server to make user can use system comfortably.

from django_plotly_dash  import DjangoDash
from flask_caching import Cache


app = DjangoDash(name='SimpleExample')
cache = Cache(app.server, config={
    'CACHE_TYPE': 'file_system',
    'CACHE_DIR': 'cache-dir',
    'CACHE_THRESHOLD': 30
})
AttributeError: 'DjangoDash' object has no attribute 'server'

Fixed: django_dash_plotly → django_plotly_dash

Here is answer for my question. This method seems to be working well.
If there are any other solutions, please tell me.

import flask
from django_plotly_dash import DjangoDash
from flask_caching import Cache


app = DjangoDash(name='SimpleExample')
server = flask.Flask(__name__)  # This seems to be working well

cache = Cache(server, config={
    'CACHE_TYPE': 'file_system',
    'CACHE_DIR': 'cache-dir',
    'CACHE_THRESHOLD': 30
})
1 Like

Thanks so much @MKX , I searched for so long on this error- finally found your post!