标签:ons location short pip3 views http cut 最大 dia
cmd 下载:redis
pip3 install django-redis
setting.py
CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://127.0.0.1:6379", # redis 路径 "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", "CONNECTION_POOL_KWARGS": {"max_connections": 100} #最大连接数 # "PASSWORD": "密码", } } }
views.py
from django.shortcuts import render,HttpResponse import redis from django_redis import get_redis_connection def index(request): conn = get_redis_connection("default") print("123456") return HttpResponse(‘设置成功‘) def order(request): conn = get_redis_connection("back") return HttpResponse(‘获取成功‘)
标签:ons location short pip3 views http cut 最大 dia
原文地址:https://www.cnblogs.com/jiangchunsheng/p/9142157.html