首先下载django_redis 接下来我们在settings文件里面配置. 在settings里面加入CACHES往里面复制上下面的代码 LOCATION这个地址最后面的这个数字是配置在几号库 在django_redis包里面有个方法叫 get_redis_connection 比如我们要存入redis的0号库我们就 get_redis_connection("default") 用一个变量接受下这个方法我们就可以写redis中的语法了.
---> 1 cache = get_redis_connection(‘default’)File D:\Python_work\project_env\lib\site-packages\django_redis_init_.py:15, in get_redis_connection(alias, write) 12 cache = caches[alias] 14 if not hasattr(cache, “client”):—> 15 raise NotImplementedError(“This backend does not sup...
因为我不用windows 不太能确定 但我建议你使用课程说的python与django版本 因为3.8有很大变化 可能出现不兼容 如果其他sdk没升级对应3.8的版本必定会报错 同时你也可以降低redis版本 看看去是不是版本bug 1 回复 提问者 水镜云墨 #1 谢谢老师,我感觉在windows上还是比较难搞,我还是换Linux学这门课好了哈哈 回复...
When using Sentinels connection to Redis instead of a "single host", when displaying theviews.statsview, the following exception is raised: Traceback(mostrecentcalllast):File"/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py",line55,ininnerresponse=get_response(request)^^^...