There are several things we need to do in order to prepare caching for our Django project:
- Let's install the Redis service. For example, the simplest way to do that on macOS is to use Homebrew:
$ brew install redis
- Then, you can start, stop, or restart the Redis service with these commands:
$ brew services start redis$ brew services stop redis$ brew services restart redis
On other operating systems, you can install Redis using apt-get, yum, or other default package management utilities. Another option is to compile it from the source, as mentioned at https://redis.io/download.
- Install the Redis cache backend for Django and its dependencies in your virtual environment, as follows:
(env)$ pip install redis==3.3.11(env)$ ...