Hi,
I installed django-oscar-elasticsearch with pip and then added the settings to my settings.py file as described in the README.md file. But when I tried to run migrate I get the following error:
(venv) ➜ shop-cms git:(main) ✗ python manage.py check
Traceback (most recent call last):
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/wagtail/search/backends/__init__.py", line 43, in import_backend
backend_module = import_module(dotted_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/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar_elasticsearch/search/backend.py", line 3, in <module>
SearchBackend = get_class("search.search", "SearchBackend")
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 40, in get_class
return get_classes(module_label, [classname], module_prefix)[0]
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 50, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 120, in default_class_loader
local_module = _import_module(local_module_label, classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 141, in _import_module
return __import__(module_label, fromlist=classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar_elasticsearch/search/search.py", line 3, in <module>
from extendedsearch.backend import SearchBackend
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/extendedsearch/backend.py", line 8, in <module>
from wagtail.search.backends.elasticsearch6 import (
ModuleNotFoundError: No module named 'wagtail.search.backends.elasticsearch6'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/wagtail/search/backends/__init__.py", line 75, in get_search_backend
backend_cls = import_backend(backend)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/wagtail/search/backends/__init__.py", line 50, in import_backend
raise ImportError from e
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/arun/Projects/zite69/shop-cms/manage.py", line 22, in <module>
main()
File "/home/arun/Projects/zite69/shop-cms/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute
django.setup()
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
app_config.ready()
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar_elasticsearch/search/apps.py", line 18, in ready
self.search_view = get_class("search.views", "CatalogueSearchView")
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 40, in get_class
return get_classes(module_label, [classname], module_prefix)[0]
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 50, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 120, in default_class_loader
local_module = _import_module(local_module_label, classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 141, in _import_module
return __import__(module_label, fromlist=classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar_elasticsearch/search/views.py", line 13, in <module>
get_product_search_handler_class = get_class(
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 40, in get_class
return get_classes(module_label, [classname], module_prefix)[0]
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 50, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 107, in default_class_loader
oscar_module = _import_module(oscar_module_label, classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 141, in _import_module
return __import__(module_label, fromlist=classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/apps/catalogue/search_handlers.py", line 8, in <module>
SearchHandler, SearchResultsPaginationMixin = get_classes(
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 50, in get_classes
return class_loader(module_label, classnames, module_prefix)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 120, in default_class_loader
local_module = _import_module(local_module_label, classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar/core/loading.py", line 141, in _import_module
return __import__(module_label, fromlist=classnames)
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/oscar_elasticsearch/search/search_handlers.py", line 13, in <module>
SearchBackend = get_search_backend()
File "/home/arun/Projects/zite69/shop-cms/venv/lib/python3.10/site-packages/wagtail/search/backends/__init__.py", line 77, in get_search_backend
raise InvalidSearchBackendError(f"Could not find backend '{backend}': {e}")
wagtail.search.backends.InvalidSearchBackendError: Could not find backend 'oscar_elasticsearch.search.backend':
I looked and saw that backend was just a .py file, which defined a SearchBackend class. So I tried changing WAGTAIL_SEARCHBACKENDS["default"]["BACKEND"] to 'oscar_elasticsearch.search.backend.SearchBackend but I still got the same error.
Going through the error it looks like wagtail-extendedsearch package is referring to elasticsearch6.py here but wagtail has updated and no longer has a elasticsearch6.py file as can be seen here
Hi, I installed django-oscar-elasticsearch with pip and then added the settings to my settings.py file as described in the README.md file. But when I tried to run migrate I get the following error:
I looked and saw that backend was just a .py file, which defined a SearchBackend class. So I tried changing WAGTAIL_SEARCHBACKENDS["default"]["BACKEND"] to 'oscar_elasticsearch.search.backend.SearchBackend but I still got the same error.