I'm using django-cache-redis, and I'm stuck in the following paradox:
# in `python manage.py shell`
import redis
r = redis.StrictRedis(host='127.0.0.1', port=20789, db=0)
r.set('foo', 'bar') # returns True
from django.core.cache import cache
cache.set('foo', 'bar', 1) # raises redis.exceptions.ConnectionError
Traceback (most recent call last): redis.exceptions.ConnectionError: Error -2 connecting to 127.0.0.1:20789:0. Name or service not known.
Notice that the host, the port and the db are the same in both cases.
The use of import redis
was already a debug; using redis-ctl also works. I also tried changing from 127.0.0.1
to localhost
, as per this question, without success.
Any idea of what this might be?
My CACHES
config is already the minimal one:
CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': '127.0.0.1:20789:0',
'TIMEOUT': 60*60*24,
}
}