According to the Django tutorial I make a templates directory under BASE_DIR, and add both an admin and an Grappelli subfolder, later copying base.html from both and putting each in its respective directory. Then I make some changes, add some CSS and JS... Reload the test server but no change is reflected at my admin interface, even the CSS/JS I add is not there!
my TEMPLATES in settings.py:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
],
},
},
]
i must be doing something utterly wrong, but i have no idea what and the documentation isn't helping.
ANSWER: The problem was the 'DIRS': [] only working in django 1.8+, for Django 1.7- we need to use the following:
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
my settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__) + '/../')
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'apps.projects.context_processors.status',
)
SITE_ID = 1
ROOT_URLCONF = 'apps.urls'
WSGI_APPLICATION = 'apps.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR + '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = PROJECT_DIR + '/media/'
TEMPLATE_DIRS = (
PROJECT_DIR + '/templates/',
)