Django 4.0.1 无法导入名称“SortedDict”来自“django.utils.datastructs”
我的项目无法运行!我需要帮助!
我只是填写表格。然后单击登录按钮。错误:
Traceback (most recent call last):
File "/home/pc/.local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/pc/.local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/pc/Documents/Projects/Django/Travel/Web/views.py", line 92, in sign_in
user = auth.authenticate(username=username, password=password)
File "/home/pc/.local/lib/python3.10/site-packages/django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper
return func(*func_args, **func_kwargs)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/__init__.py", line 77, in authenticate
user = backend.authenticate(request, **credentials)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/backends.py", line 48, in authenticate
if user.check_password(password) and self.user_can_authenticate(user):
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 115, in check_password
return check_password(raw_password, self.password, setter)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 47, in check_password
preferred = get_hasher(preferred)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 129, in get_hasher
return get_hashers()[0]
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 96, in get_hashers
hasher_cls = import_string(hasher_path)
File "/home/pc/.local/lib/python3.10/site-packages/django/utils/module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
File "/home/pc/.local/lib/python3.10/site-packages/django/utils/module_loading.py", line 15, in cached_import
import_module(module_path)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pc/.local/lib/python3.10/site-packages/django_scrypt/hashers.py", line 2, in <module>
from django.utils.datastructures import SortedDict
ImportError: cannot import name 'SortedDict' from 'django.utils.datastructures' (/home/pc/.local/lib/python3.10/site-packages/django/utils/datastructures.py)
任何人都可以帮助我吗?我尝试了很多次。但什么也没发生!
My project isn't working! I need help!
I'm just fill in the forms. And click login button. Error:
Traceback (most recent call last):
File "/home/pc/.local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/pc/.local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/pc/Documents/Projects/Django/Travel/Web/views.py", line 92, in sign_in
user = auth.authenticate(username=username, password=password)
File "/home/pc/.local/lib/python3.10/site-packages/django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper
return func(*func_args, **func_kwargs)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/__init__.py", line 77, in authenticate
user = backend.authenticate(request, **credentials)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/backends.py", line 48, in authenticate
if user.check_password(password) and self.user_can_authenticate(user):
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 115, in check_password
return check_password(raw_password, self.password, setter)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 47, in check_password
preferred = get_hasher(preferred)
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 129, in get_hasher
return get_hashers()[0]
File "/home/pc/.local/lib/python3.10/site-packages/django/contrib/auth/hashers.py", line 96, in get_hashers
hasher_cls = import_string(hasher_path)
File "/home/pc/.local/lib/python3.10/site-packages/django/utils/module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
File "/home/pc/.local/lib/python3.10/site-packages/django/utils/module_loading.py", line 15, in cached_import
import_module(module_path)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pc/.local/lib/python3.10/site-packages/django_scrypt/hashers.py", line 2, in <module>
from django.utils.datastructures import SortedDict
ImportError: cannot import name 'SortedDict' from 'django.utils.datastructures' (/home/pc/.local/lib/python3.10/site-packages/django/utils/datastructures.py)
Anyone can help me? I tried many times. But nothing happened!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SortedDict
从 Django 1.7 开始已弃用,并在 Django 1.9 中删除。使用collections.OrderedDict
代替SortedDict
is deprecated as of Django 1.7 and removed in Django 1.9. Use collections.OrderedDict
instead