2
votes

I have been trying to install django-oscar but it gives me this error when I try to make migrations (via : 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)

Code I am using:

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',
            ],
        },
    },
]
1

1 Answers

0
votes

From the release notes for 2.0+ (2019-07-04):

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.