ImportError: cannot import name 'OSCAR_MAIN_TEMPLATE_DIR'

ImportError: cannot import name 'OSCAR_MAIN_TEMPLATE_DIR'

我一直在尝试安装 django-oscar,但是当我尝试进行迁移时它给了我这个错误(通过:python manage.py migrate)。

ImportError: cannot import name 'OSCAR_MAIN_TEMPLATE_DIR' from 'oscar' (C:\Users\dell\Envs\eshop\lib\site-packages\oscar__init__.py)

我使用的代码:

from oscar import OSCAR_MAIN_TEMPLATE_DIR

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR, 'templates'),
            OSCAR_MAIN_TEMPLATE_DIR
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.i18n',
                'django.contrib.messages.context_processors.messages',

                'oscar.apps.search.context_processors.search_form',
                'oscar.apps.promotions.context_processors.promotions',
                'oscar.apps.checkout.context_processors.checkout',
                'oscar.apps.customer.notifications.context_processors.notifications',
                'oscar.core.context_processors.metadata',
            ],
        },
    },
]

来自 2.0+ (2019-07-04) 的 release notes

OSCAR_MAIN_TEMPLATE_DIR setting has been removed and existing templates updated with the full path. See issue:1378, issue:2250. Please update your templates accordingly.