Reputation: 29
I want to create an app using Django that users can interact with and post to using HTTP requests, but I don't want to store the data in a database, the data should be lost once the server is turned off. I was thinking of using arrays and sessions but I'm just wondering if there are other options. It is a very simple app only storing strings and integers. Thank you in advance!
Upvotes: 1
Views: 748
Reputation: 298492
This really depends on the complexity of your server architecture and what type of data you're trying to store.
You can use Django's cache framework to abstract away the backend that you actually use to store the data. It's configurable to use either a Python dictionary, Memcached (which is entirely volatile), or redis (you'll have to install another module and configure redis not to persist to disk).
The advantage of using Memcached or redis is that they're easily able to handle multiple processes and threads mutating the data and can survive your Python process restarting.
Upvotes: 0
Reputation: 11695
For above case we can use the redis. we have a redis package for python. we can install it with pip.
pip install redis
References: https://askubuntu.com/questions/868848/how-to-install-redis-on-ubuntu-16-04, https://redis.io/documentation,
Upvotes: 0