remind user to restart c3nav if no external cache is configured
This commit is contained in:
parent
aa7ffab45c
commit
5976a18946
3 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
@ -7,3 +9,6 @@ class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
from c3nav.mapdata.models import MapUpdate
|
from c3nav.mapdata.models import MapUpdate
|
||||||
MapUpdate.objects.create(type='management')
|
MapUpdate.objects.create(type='management')
|
||||||
|
|
||||||
|
if not settings.HAS_REAL_CACHE:
|
||||||
|
print(_('You have no external cache configured, so don\'t forget to restart your c3nav instance!'))
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from c3nav.mapdata.tasks import process_map_updates
|
from c3nav.mapdata.tasks import process_map_updates
|
||||||
|
|
||||||
|
@ -8,3 +10,6 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
process_map_updates()
|
process_map_updates()
|
||||||
|
|
||||||
|
if not settings.HAS_REAL_CACHE:
|
||||||
|
print(_('You have no external cache configured, so don\'t forget to restart your c3nav instance!'))
|
||||||
|
|
|
@ -118,11 +118,13 @@ CACHES = {
|
||||||
'LOCATION': 'unique-snowflake',
|
'LOCATION': 'unique-snowflake',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HAS_REAL_CACHE = False
|
||||||
|
|
||||||
SESSION_ENGINE = "django.contrib.sessions.backends.db"
|
SESSION_ENGINE = "django.contrib.sessions.backends.db"
|
||||||
|
|
||||||
HAS_MEMCACHED = config.has_option('memcached', 'location')
|
HAS_MEMCACHED = config.has_option('memcached', 'location')
|
||||||
if HAS_MEMCACHED:
|
if HAS_MEMCACHED:
|
||||||
|
HAS_REAL_CACHE = True
|
||||||
CACHES['default'] = {
|
CACHES['default'] = {
|
||||||
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
||||||
'LOCATION': config.get('memcached', 'location'),
|
'LOCATION': config.get('memcached', 'location'),
|
||||||
|
@ -131,6 +133,7 @@ if HAS_MEMCACHED:
|
||||||
|
|
||||||
HAS_REDIS = config.has_option('redis', 'location')
|
HAS_REDIS = config.has_option('redis', 'location')
|
||||||
if HAS_REDIS:
|
if HAS_REDIS:
|
||||||
|
HAS_REAL_CACHE = True
|
||||||
CACHES['redis'] = {
|
CACHES['redis'] = {
|
||||||
"BACKEND": "django_redis.cache.RedisCache",
|
"BACKEND": "django_redis.cache.RedisCache",
|
||||||
"LOCATION": config.get('redis', 'location'),
|
"LOCATION": config.get('redis', 'location'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue