作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在从 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'.
技术细节
最佳答案
您尚未安装软件包。
试试这个:
pip install sorl-thumbnail
关于django - ModuleNotFoundError : No module named 'sorl' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64198161/
我是一名优秀的程序员,十分优秀!