Reputation: 69
We're trying to override the admin page for Django 1.6, but it continues to get it from django/contrib/templates/...:
settings.py:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
[os.path.join(BASE_DIR, 'templates')],
],
'OPTIONS': {
'context_processors': [
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
'loaders': [
# insert your TEMPLATE_LOADERS here
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]
},
},
]
]
and the files structure:
project
project
templates
app_name
admin
file_to_override <--it varies here from being inside the app_name or inside template itself
I'm not sure why the directories arent working
Upvotes: 0
Views: 60
Reputation: 599816
I don't know why you're using Django 1.6, but the TEMPLATES dict syntax you quote is only for Django 1.8+. In previous versions, you need to specify all the options individually.
Also note you have wrongly surrounded the DIRS value with two list brackets.
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, 'templates'),
]
TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
]
TEMPLATE_LOADERS = [
# insert your TEMPLATE_LOADERS here
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]
Upvotes: 1