Commit a392a9ef authored by Michal Čihař's avatar Michal Čihař

Use TEMPLATES settings for configuring templates in Django

Issue #946
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 15aa5af5
......@@ -173,13 +173,32 @@ STATICFILES_FINDERS = (
# You can generate it using examples/generate-secret-key
SECRET_KEY = 'jm8fqjlg+5!#xu%e-oh#7!$aa7!6avf7ud*_v=chdrb9qdco6('
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'html'),
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.template.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
'weblate.trans.context_processors.weblate_context',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
]),
],
},
},
]
# GitHub username for sending pull requests.
# Please see the documentation for more details.
......@@ -262,14 +281,6 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'weblate.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates"
# or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, 'html'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -293,17 +304,6 @@ INSTALLED_APPS = (
# Path to locales
LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'), )
# Context processors
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.template.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
'weblate.trans.context_processors.weblate_context',
)
# Custom exception reporter to include some details
DEFAULT_EXCEPTION_REPORTER_FILTER = \
'weblate.trans.debug.WeblateExceptionReporterFilter'
......
......@@ -194,6 +194,14 @@ def performance(request):
', '.join(settings.ALLOWED_HOSTS),
))
if settings.TEMPLATES:
loader = settings.TEMPLATES[0].get(
'OPTIONS', {}
).get(
'loaders', [['']]
)[0][0]
else:
loader = settings.TEMPLATE_LOADERS[0][0]
# Cached template loader
checks.append((
_('Cached template loader'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment