Django中配置用Redis作緩存和session

django-redis文檔:

http://django-redis-chs.readthedocs.io/zh_CN/latest/#redis

1、在Django中配置

# Django的緩存配置
CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://127.0.0.1:6379/9", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } } } # 配置session存儲
SESSION_ENGINE = "django.contrib.sessions.backends.cache" SESSION_CACHE_ALIAS = "default"
相關文章
相關標籤/搜索