python2.7 - django cannot connect to redis
怪我咯
怪我咯 2017-05-16 13:18:54
0
2
708

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?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
过去多啦不再A梦

'LOCARION' is this a typo?

刘奇
 'LOCATION': 'redis://127.0.0.1:6379/4',
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template