Skip to content

"cannot import name 'Category'" error when running the indexing command #103

@totex

Description

@totex

Hello! I have an elasticserch instance running in docker. I have used the sandbox example settings for reference. I have created 1 sample product to try the indexing.

When I run the indexer command:
python manage.py update_oscar_index

I get the following error:
ImportError: cannot import name 'Category' from 'oscar_odin.resources.catalogue'

I have added the following line to "oscar_odin/resources/catalogue.py":
Category = get_model("catalogue", "Category")

After that I am getting the next error:
ModuleNotFoundError: No module named 'oscar_odin.mappings._common'

Is this a bug or do I miss something in my settings?

Here are my settings.py:

INSTALLED_APPS = [
    ..., 
    'widget_tweaks',
    'haystack',
    'treebeard',
    'sorl.thumbnail',
    'django_tables2',
    'oscar_elasticsearch.search.apps.OscarElasticSearchConfig',
    'oscar_odin.apps.OscarOdinAppConfig',
]

OSCAR_ELASTICSEARCH_PROJECT_NAME = "oscar_elasticsearch"
OSCAR_ELASTICSEARCH_FILTER_AVAILABLE = False
OSCAR_ELASTICSEARCH_SERVER_URLS = [os.environ.get("OSCAR_ELASTICSEARCH_SERVER_URLS", "http://127.0.0.1:9200")]

WAGTAILSEARCH_BACKENDS = {
    "default": {
        "BACKEND": "oscar_elasticsearch.search.backend",
        "URLS": ["http://127.0.0.1:9200"],
        "INDEX": "oscar1",
        "TIMEOUT": 120,
        "OPTIONS": {},
        "INDEX_SETTINGS": {},
        "ATOMIC_REBUILD": True,
        "AUTO_UPDATE": True,
    }
}
HAYSTACK_CONNECTIONS = {"default": {}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions