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

Provide more verbose hints for production setup

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent d6fe9073
...@@ -19,14 +19,16 @@ ...@@ -19,14 +19,16 @@
<thead> <thead>
<tr> <tr>
<th>{% trans "Check" %}</th> <th>{% trans "Check" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Result" %}</th> <th>{% trans "Result" %}</th>
<th>{% trans "Documentation" %}</th> <th>{% trans "Documentation" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for check in checks %} {% for check in checks %}
<tr class="row{% cycle '1' '2' %} {{ check.3 }}"> <tr class="row{% cycle '1' '2' %} {{ check.4 }}">
<td>{{ check.0 }}</td> <td>{{ check.0 }}</td>
<td>{{ check.3 }}</td>
<td>{% admin_boolean_icon check.1 %}</td> <td>{% admin_boolean_icon check.1 %}</td>
<td><a href="{% documentation "admin/install" check.2 %}">{% trans "Documentation" %}</a></td> <td><a href="{% documentation "admin/install" check.2 %}">{% trans "Documentation" %}</a></td>
</tr> </tr>
......
...@@ -75,18 +75,21 @@ def performance(request): ...@@ -75,18 +75,21 @@ def performance(request):
_('Debug mode'), _('Debug mode'),
not settings.DEBUG, not settings.DEBUG,
'production-debug', 'production-debug',
settings.DEBUG,
)) ))
# Check for domain configuration # Check for domain configuration
checks.append(( checks.append((
_('Site domain'), _('Site domain'),
Site.objects.get_current().domain not in DEFAULT_DOMAINS, Site.objects.get_current().domain not in DEFAULT_DOMAINS,
'production-site', 'production-site',
Site.objects.get_current().domain,
)) ))
# Check database being used # Check database being used
checks.append(( checks.append((
_('Database backend'), _('Database backend'),
"sqlite" not in settings.DATABASES['default']['ENGINE'], "sqlite" not in settings.DATABASES['default']['ENGINE'],
'production-database', 'production-database',
settings.DATABASES['default']['ENGINE'],
)) ))
# Check configured admins # Check configured admins
checks.append(( checks.append((
...@@ -94,6 +97,7 @@ def performance(request): ...@@ -94,6 +97,7 @@ def performance(request):
len(settings.ADMINS) > 0 or len(settings.ADMINS) > 0 or
'noreply@weblate.org' in [x[1] for x in settings.ADMINS], 'noreply@weblate.org' in [x[1] for x in settings.ADMINS],
'production-admins', 'production-admins',
u', '.join([x[1] for x in settings.ADMINS]),
)) ))
# Check offloading indexing # Check offloading indexing
checks.append(( checks.append((
...@@ -101,6 +105,7 @@ def performance(request): ...@@ -101,6 +105,7 @@ def performance(request):
_('Indexing offloading'), _('Indexing offloading'),
appsettings.OFFLOAD_INDEXING, appsettings.OFFLOAD_INDEXING,
'production-indexing', 'production-indexing',
appsettings.OFFLOAD_INDEXING
)) ))
if appsettings.OFFLOAD_INDEXING: if appsettings.OFFLOAD_INDEXING:
if IndexUpdate.objects.count() < 20: if IndexUpdate.objects.count() < 20:
...@@ -115,6 +120,7 @@ def performance(request): ...@@ -115,6 +120,7 @@ def performance(request):
_('Indexing offloading processing'), _('Indexing offloading processing'),
index_updates, index_updates,
'production-indexing', 'production-indexing',
IndexUpdate.objects.count(),
)) ))
# Check for sane caching # Check for sane caching
caches = settings.CACHES['default']['BACKEND'].split('.')[-1] caches = settings.CACHES['default']['BACKEND'].split('.')[-1]
...@@ -131,12 +137,15 @@ def performance(request): ...@@ -131,12 +137,15 @@ def performance(request):
_('Django caching'), _('Django caching'),
caches, caches,
'production-cache', 'production-cache',
settings.CACHES['default']['BACKEND'],
)) ))
# Avatar caching # Avatar caching
checks.append(( checks.append((
_('Avatar caching'), _('Avatar caching'),
'avatar' in settings.CACHES, 'avatar' in settings.CACHES,
'production-cache-avatar', 'production-cache-avatar',
settings.CACHES['avatar']['BACKEND']
if 'avatar' in settings.CACHES else '',
)) ))
# Check email setup # Check email setup
default_mails = ( default_mails = (
...@@ -151,37 +160,42 @@ def performance(request): ...@@ -151,37 +160,42 @@ def performance(request):
settings.DEFAULT_FROM_EMAIL not in default_mails settings.DEFAULT_FROM_EMAIL not in default_mails
), ),
'production-email', 'production-email',
', '.join((settings.SERVER_EMAIL, settings.DEFAULT_FROM_EMAIL)),
)) ))
# libravatar library # libravatar library
checks.append(( checks.append((
_('Federated avatar support'), _('Federated avatar support'),
HAS_LIBRAVATAR, HAS_LIBRAVATAR,
'production-avatar', 'production-avatar',
HAS_LIBRAVATAR,
)) ))
# pyuca library # pyuca library
checks.append(( checks.append((
_('pyuca library'), _('pyuca library'),
HAS_PYUCA, HAS_PYUCA,
'production-pyuca', 'production-pyuca',
HAS_PYUCA,
)) ))
# Cookie signing key # Cookie signing key
checks.append(( checks.append((
_('Secret key'), _('Secret key'),
settings.SECRET_KEY != settings_example.SECRET_KEY, settings.SECRET_KEY != settings_example.SECRET_KEY,
'production-secret', 'production-secret',
settings.SECRET_KEY,
)) ))
# Allowed hosts # Allowed hosts
checks.append(( checks.append((
_('Allowed hosts'), _('Allowed hosts'),
len(settings.ALLOWED_HOSTS) > 0, len(settings.ALLOWED_HOSTS) > 0,
'production-hosts', 'production-hosts',
', '.join(settings.ALLOWED_HOSTS),
)) ))
# Cached template loader # Cached template loader
checks.append(( checks.append((
_('Cached template loader'), _('Cached template loader'),
'cached.Loader' in settings.TEMPLATE_LOADERS[0][0], 'cached.Loader' in settings.TEMPLATE_LOADERS[0][0],
'production-templates' 'production-templates',
)) ))
# Check for serving static files # Check for serving static files
...@@ -190,6 +204,7 @@ def performance(request): ...@@ -190,6 +204,7 @@ def performance(request):
_('Admin static files'), _('Admin static files'),
False, False,
'production-admin-files', 'production-admin-files',
'',
'order-cell', 'order-cell',
)) ))
......
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