gpt4 book ai didi

django - ModuleNotFoundError : No module named 'sorl'

转载 作者:行者123 更新时间:2023-12-05 00:55:31 29 4
gpt4 key购买 nike

在从 https://django-oscar.readthedocs.io/en/2.0.4/internals/getting_started.html 安装 django-oscar 时出现以下错误

settings.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',

'oscar',
'oscar.apps.analytics',
'oscar.apps.checkout',
'oscar.apps.address',
'oscar.apps.shipping',
'oscar.apps.catalogue',
'oscar.apps.catalogue.reviews',
'oscar.apps.partner',
'oscar.apps.basket',
'oscar.apps.payment',
'oscar.apps.offer',
'oscar.apps.order',
'oscar.apps.customer',
'oscar.apps.search',
'oscar.apps.voucher',
'oscar.apps.wishlists',
'oscar.apps.dashboard',
'oscar.apps.dashboard.reports',
'oscar.apps.dashboard.users',
'oscar.apps.dashboard.orders',
'oscar.apps.dashboard.catalogue',
'oscar.apps.dashboard.offers',
'oscar.apps.dashboard.partners',
'oscar.apps.dashboard.pages',
'oscar.apps.dashboard.ranges',
'oscar.apps.dashboard.reviews',
'oscar.apps.dashboard.vouchers',
'oscar.apps.dashboard.communications',
'oscar.apps.dashboard.shipping',

# 3rd-party apps that oscar depends on
'widget_tweaks',
'haystack',
'treebeard',
'sorl.thumbnail',
'django_tables2',
]

HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
'URL': 'http://127.0.0.1:8983/solr',
'INCLUDE_SPELLING': True,
},
}

运行 py .\manage.py migrate 或 py .\manage.py makemigrations 后出现以下错误

Traceback (most recent call last):
File ".\manage.py", line 21, in
main()
File ".\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\core\management_init_.py", line 401, in execute_from_command_line
utility.execute()
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\core\management_init_.py", line 377, in execute
django.setup()
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "c:\program files\python37\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sorl'

我还发现 solr-thumbanil 或 solr 没有安装。如果我安装 solr-thumbnail 则会出现以下错误

Traceback (most recent call last):
File ".\manage.py", line 21, in
main()
File ".\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\core\management_init_.py", line 401, in execute_from_command_line
utility.execute()
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\core\management_init_.py", line 377, in execute
django.setup()
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\apps\registry.py", line 122, in populate
app_config.ready()
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\config.py", line 27, in ready
self.password_reset_form = get_class('customer.forms', 'PasswordResetForm')
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 42, in get_class
return get_classes(module_label, [classname], module_prefix)[0]
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 52, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 110, in default_class_loader
oscar_module = _import_module(oscar_module_label, classnames)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 144, in _import_module
return import(module_label, fromlist=classnames)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\apps\customer\forms.py", line 14, in
from oscar.apps.customer.utils import get_password_reset_url, normalise_email
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\apps\customer\utils.py", line 8, in
Dispatcher = get_class('communication.utils', 'Dispatcher')
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 42, in get_class
return get_classes(module_label, [classname], module_prefix)[0]
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 52, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 110, in default_class_loader
oscar_module = _import_module(oscar_module_label, classnames)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 144, in _import_module
return import(module_label, fromlist=classnames)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\apps\communication\utils.py", line 9, in
CommunicationEventType = get_model('communication', 'CommunicationEventType')
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\oscar\core\loading.py", line 248, in get_model
return apps.get_model(app_label, model_name)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\apps\registry.py", line 206, in get_model
app_config = self.get_app_config(app_label)
File "D:\projects\ecommerce\django-oscar-env\lib\site-packages\django\apps\registry.py", line 163, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'communication'.

技术细节

  1. Python 版本:3.7.3
  2. Django 版本:3.0.10
  3. 奥斯卡版:2.1

最佳答案

您尚未安装软件包。

试试这个:

pip install sorl-thumbnail

关于django - ModuleNotFoundError : No module named 'sorl' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64198161/

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