Move cache and search conf to prod settings

This commit is contained in:
Oleg Lavrovsky 2017-04-11 00:51:40 +02:00
parent 24607793ac
commit ee7eb96954
2 changed files with 14 additions and 28 deletions

View file

@ -163,31 +163,6 @@ COMPRESS_PRECOMPILERS = [
('text/x-scss', 'django_libsass.SassCompiler'),
]
# Use Redis as the cache backend for extra performance
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
'KEY_PREFIX': 'publichealth',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
}
}
}
# Use Elasticsearch as the search backend for extra performance and better search results
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.db',
#'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
'INDEX': 'publichealth',
},
}
# Wagtail settings
WAGTAIL_SITE_NAME = "Public Health Schweiz"

View file

@ -97,7 +97,19 @@ if 'MAILGUN_KEY' in os.environ:
}
DEFAULT_FROM_EMAIL = env['MAILGUN_FROM']
# Redis
# Use Redis as the cache backend for extra performance
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
'KEY_PREFIX': 'publichealth',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
}
}
}
# Redis location can either be passed through with REDIS_HOST or REDIS_SOCKET
if 'REDIS_URL' in env:
@ -128,8 +140,7 @@ if REDIS_LOCATION is not None:
}
}
# Elasticsearch
# Use Elasticsearch as the search backend for extra performance and better search results
if 'ELASTICSEARCH_URL' in env:
WAGTAILSEARCH_BACKENDS = {