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

Fix cached lodaer detection and reporting in admin interface

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent dadb3925
......@@ -38,7 +38,6 @@ if django.VERSION < (1, 4, 0):
#
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
......
......@@ -28,6 +28,8 @@ from django.utils.translation import ugettext as _
from django.conf import settings
import django
import six
from weblate.trans.models import SubProject, IndexUpdate
from weblate import settings_example
from weblate import appsettings
......@@ -67,6 +69,23 @@ def report(request):
)
def get_first_loader():
"""Returns first loader from settings"""
if settings.TEMPLATES:
loaders = settings.TEMPLATES[0].get(
'OPTIONS', {}
).get(
'loaders', [['']]
)
else:
loaders = settings.TEMPLATE_LOADERS
if isinstance(loaders[0], six.string_types):
return loaders[0]
return loaders[0][0]
@staff_member_required
def performance(request):
"""
......@@ -194,19 +213,13 @@ 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]
loader = get_first_loader()
# Cached template loader
checks.append((
_('Cached template loader'),
'cached.Loader' in loader,
'production-templates',
loader,
))
# Check for serving static files
......
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