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