gpt4 book ai didi

python - Django 'SessionStore' 对象没有属性 '_session_cache'

转载 作者:行者123 更新时间:2023-12-04 11:24:15 24 4
gpt4 key购买 nike

我目前收到以下错误的垃圾邮件:
dictionary update sequence element #0 has length 14; 2 is required这似乎是由 ('SessionStore' object has no attribute '_session_cache') 引起的

我在这个问题中读到:Django project looking for "attribute '_session_cache'"问题可能是我没有 django_session表,但我这样做,它充满了内容。

知道什么会引起这种情况吗?

我正在使用 Python 3.6.7 , Django 2.1.7
这是完整的错误堆栈:

File "/path/to/venv/lib/python3.6/site-packages/django/contrib/sessions/backends/base.py" in _get_session
190. return self._session_cache

During handling of the above exception ('SessionStore' object has no attribute '_session_cache'), another exception occurred:

File "/path/to/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/path/to/venv/lib/python3.6/site-packages/django/utils/deprecation.py" in __call__
90. response = self.process_request(request)

File "/path/to/venv/lib/python3.6/site-packages/django/middleware/locale.py" in process_request
21. language = translation.get_language_from_request(request, check_path=i18n_patterns_used)

File "/path/to/venv/lib/python3.6/site-packages/django/utils/translation/__init__.py" in get_language_from_request
222. return _trans.get_language_from_request(request, check_path)

File "/path/to/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in get_language_from_request
464. lang_code = request.session.get(LANGUAGE_SESSION_KEY)

File "/path/to/venv/lib/python3.6/site-packages/django/contrib/sessions/backends/base.py" in get
66. return self._session.get(key, default)

File "/path/to/venv/lib/python3.6/site-packages/django/contrib/sessions/backends/base.py" in _get_session
195. self._session_cache = self.load()

File "/path/to/venv/lib/python3.6/site-packages/django/contrib/sessions/backends/db.py" in load
43. s = self._get_session_from_db()

File "/path/to/venv/lib/python3.6/site-packages/django/contrib/sessions/backends/db.py" in _get_session_from_db
34. expire_date__gt=timezone.now()

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/query.py" in get
390. clone = self.filter(*args, **kwargs)

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/query.py" in filter
844. return self._filter_or_exclude(False, *args, **kwargs)

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/query.py" in _filter_or_exclude
862. clone.query.add_q(Q(*args, **kwargs))

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/sql/query.py" in add_q
1263. clause, _ = self._add_q(q_object, self.used_aliases)

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/sql/query.py" in _add_q
1289. joinpromoter.add_votes(needed_inner)

File "/path/to/venv/lib/python3.6/site-packages/django/db/models/sql/query.py" in add_votes
2171. self.votes.update(votes)

File "/usr/lib/python3.6/collections/__init__.py" in update
620. super(Counter, self).update(iterable) # fast path when counter is empty

Exception Type: ValueError
Exception Value: dictionary update sequence element #0 has length 14; 2 is required

最佳答案

在尝试将 Django 3.1 降级到 Django 2.2 时,我遇到了同样的问题。
问题也在此处跟踪:
https://code.djangoproject.com/ticket/31592
从上面的链接:

# To fix this you need to remove sessions from cache, e.g.

from django.contrib.sessions.models import Session
Session.objects.all().delete()

关于python - Django 'SessionStore' 对象没有属性 '_session_cache',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54722170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com