Django中连接redis

1. 安装

pip install django-redis

 2. settings中配置

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "CONNECTION_POOL_KWARGS": {"max_connections": 100},
            # "PASSWORD": "密码",
            "DECODE_RESPONSES": True
        }
    }
}

 

 

---恢复内容结束---

posted @ 2019-01-23 16:38  Niuli'blog  阅读(1543)  评论(0编辑  收藏  举报