zoukankan      html  css  js  c++  java
  • Django--redis 保存session

    pipenv install django-redis

    settings.py:

    # 作为 cache backend 使用配置 使用redis保存session
    CACHES = {
        "default": {
            "BACKEND": "django_redis.cache.RedisCache",
            "LOCATION": "redis://127.0.0.1:6379/9",
            "OPTIONS": {
                "CLIENT_CLASS": "django_redis.client.DefaultClient",
            }
        }
    }
    
    # Django 默认可以使用任何 cache backend 作为 session backend, 将 django-redis 作为 session 储存后端不用安装任何额外的 backend
    SESSION_ENGINE = "django.contrib.sessions.backends.cache"
    SESSION_CACHE_ALIAS = "default"
    

     redis-cli -h 127.0.0.1

    select 9(指定的数据库)

    keys *

  • 相关阅读:
    shell 参数个数
    小坑也难受
    MaHua简介
    airflow Operators
    datax
    T-SQL 更新表操作
    T-SQL时间函数
    linux学习网站
    好看的页面
    函数-1
  • 原文地址:https://www.cnblogs.com/wangyue0925/p/11150809.html
Copyright © 2011-2022 走看看