django_redis
无法从six
导入django.utils
跟踪:
Internal Server Error: /harem/reponse/
Traceback (most recent call last):
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/core/cache/__init__.py", line 50, in _create_cache
backend_cls = import_string(backend)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django_redis/cache.py", line 8, in <module>
from .util import load_class
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django_redis/util.py", line 8, in <module>
from django.utils import six
ImportError: cannot import name 'six'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/utils/deprecation.py", line 93, in __call__
response = self.process_request(request)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/contrib/sessions/middleware.py", line 20, in process_request
request.session = self.SessionStore(session_key)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/contrib/sessions/backends/cache.py", line 17, in __init__
self._cache = caches[settings.SESSION_CACHE_ALIAS]
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/core/cache/__init__.py", line 79, in __getitem__
cache = _create_cache(alias)
File "/home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django/core/cache/__init__.py", line 53, in _create_cache
"Could not find backend '%s': %s" % (backend, e))
django.core.cache.backends.base.InvalidCacheBackendError: Could not find backend 'django_redis.cache.RedisCache': cannot import name 'six'
使用:
django-redis 4.10.0
python 3.6
答案 0 :(得分:0)
django_redis
试图从six
导入django.utils
文件“ /home/yangcoco/.virtualenvs/Django_czbk/lib/python3.6/site-packages/django_redis/util.py”,第8行, 从django.utils导入六个
但是,six
已从django
中删除。检查Django 3.0 release notes here
如果需要使用此特定版本的django_redis,请切换到最新的django_redis或Django 2.2
答案 1 :(得分:0)
您可以尝试安装django-redis的最新版本来修复issue。
这将使您能够使用features that can change how you'll develop your app.随附的Django 3
要这样做,只需直接从GitHub安装该软件包,如果您像我一样使用Pipenv,只需发出以下命令:
pipenv install git+https://github.com/niwinz/django-redis.git@master#egg=django-redis
如果您仍然想使用Django 2.X,只需将Pipfile中的Django条目编辑为:
django = "==2.*"
或发出以下命令:
pipenv install "django==2.*"