I am facing problem with django oscar template overriding. I am using Oscar 2.0.3 and Django 2.2.7
I am using method-1 mentioned in the docs. My project structure looks like
myproject
cache
catalogue (I have overridden this app)
categories
images
templates
base.html
myproject
manage.py
I have edited my TEMPLATES
as
import os
location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', x)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [location('templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'oscar.apps.search.context_processors.search_form',
'oscar.apps.checkout.context_processors.checkout',
'oscar.apps.customer.notifications.context_processors.notifications',
'oscar.core.context_processors.metadata',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
and I am making changes in base.html
but they are not replicated at 127.0.0.1:8000/catalogue/
(127.0.0.1:8000
redirects to this url)
Help is appreciated! Thanks!
The tutorial you are using is for an old version of Oscar (1.6).
In Oscar 2.0 the template structure has changed. Specifically base.html
is now at oscar/base.html
. This means that to override it you have to create a file at templates/oscar/base.html
instead of templates/base.html
.
The same applies for all other Oscar templates.