No module named redis_cache.cache

今天在python写入redis的时候碰到这个问题。下面是报错信息:

/home/ubuntu/.virtualenvs/zgxcw_incentive/local/lib/python2.7/site-packages/django_redis/__init__.pyc in get_redis_connection(alias, write)
     16     """
     17 
---> 18     cache = get_cache(alias)
     19     if not hasattr(cache.client, 'get_client'):
     20         raise NotImplementedError("This backend does not supports this feature")

/home/ubuntu/.virtualenvs/zgxcw_incentive/local/lib/python2.7/site-packages/django/core/cache/__init__.pyc in get_cache(backend, **kwargs)
    128     except (AttributeError, ImportError, ImproperlyConfigured) as e:
    129         raise InvalidCacheBackendError(
--> 130             "Could not find backend '%s': %s" % (backend, e))
    131     cache = backend_cls(location, params)
    132     # Some caches -- python-memcached in particular -- need to do a cleanup at the

InvalidCacheBackendError: Could not find backend 'redis_cache.cache.RedisCache': Error importing module redis_cache.cache: "No module named redis_cache.cache"

解决方案:
查看了django-redis的版本

pip freeze | grep redis
django-redis==4.0.0

用的是4.0.0的版本,将django-redis的版本切到3.8.3,问题解决。

pip install django-redis==3.8.3

没有去细看这两个版本的区别在哪,有兴趣的同学可以查查。
也有人看到这个报错,说是环境变量的问题,有可能吧,各种可能都试试,说不好就解决了呢。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值