1👍
✅
One of the easier things to do would be to use Django’s cache framework, and store the data in local memory, or memcached, or the database, etc. You could cache any data recieved, and used the cached data if you don’t recieve data, or it’s erroneous or whatever:
from django.core.cache import cache
# set cached data
cache.set('data', data)
# get cached data
cache.get('data')
You could also store the data other ways, on a model for instance. You should probably move the RFID reading portion out of the view, and use celery (or something else) to run it as a task, save the results, and just use the latest saved data in your view
Source:stackexchange.com