Django wants to use redis for caching. Unable to connect to redis.
#setting.py中
CACHES={
"default":{
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "127.0.0.1:6379",
'OPTIONS': {
#"CLIENT_CLASS": "redis_cache.client.DefaultClient",
"DB": 0,
"PARSER_CLASS": "redis.connection.HiredisParser",
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
"PICKLE_VERSION": -1
}
}
}
#views.py
def testCache(request):
print cache
print dir(cache)
mn = cache.get("test2")
return HttpResponse(mn)
Please give me some guidance, why can’t I connect?
'LOCARION' is this a typo?