My Django settings.py
file contains the following configuration options:
# Caches
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
'LOCATION': 'redis://redis:6379',
}
}
# Queues
RQ_QUEUES = {
'default': {
'HOST': 'redis',
'PORT': 6379,
'DB': 0,
'DEFAULT_TIMEOUT': 360,
},
}
Both CACHES
and RQ_QUEUES
contain configuration details that point to a redis server.
Is it possible to reconfigure these settings to point to an instance of fakeredis
instead ?
I have reviewed the fakeredis
documentation and so far I have only seen examples where the redis connection is manually over-ridden, every time a call to redis is made.
It seems to me that when running tests, it would be much more convenient to simply point the Django CACHE location directly to fakeredis. Is this possible?
You can starting fakeredis v2.10.1.
Change your cache settings: