From e7266e7a9d834b2372c38c5339ad6412beae39a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Wed, 26 Apr 2017 11:28:18 +0200 Subject: [PATCH] use new settings for redis --- cof/settings/common.py | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/cof/settings/common.py b/cof/settings/common.py index 14f672e0..372d7d81 100644 --- a/cof/settings/common.py +++ b/cof/settings/common.py @@ -20,25 +20,6 @@ except KeyError: raise RuntimeError("Secrets missing") -# Redis settings (for cache and channel layers) -try: - from .secret import REDIS_USER, REDIS_PASS -except ImportError: - REDIS_USER = os.environ.get("REDIS_USER", "") - REDIS_PASS = os.environ.get("REDIS_PASS", "") - -if REDIS_USER or REDIS_PASS: - REDIS_AUTH = REDIS_USER+":"+REDIS_PASS+"@" -else: - REDIS_AUTH = '' - -REDIS_HOST = os.environ.get("REDIS_HOST", "localhost") -REDIS_PORT = os.environ.get("REDIS_PORT", "6379") - -REDIS_BASE_URL = "redis://" + REDIS_AUTH + REDIS_HOST + ":" + REDIS_PORT -# To select a specific redis database, do: REDIS_BASE_URL + '/' - - # Other secrets try: from .secret import ( @@ -174,19 +155,19 @@ AUTHENTICATION_BACKENDS = ( RECAPTCHA_USE_SSL = True -# Cache settings (use db #1 of redis) - -CACHE_REDIS_URL = REDIS_BASE_URL + "/1" +# Cache settings CACHES = { 'default': { 'BACKEND': 'redis_cache.RedisCache', - 'LOCATION': CACHE_REDIS_URL, + 'LOCATION': 'redis://:{passwd}@{host}:{port}/db' + .format(passwd=REDIS_PASSWD, host=REDIS_HOST, + port=REDIS_PORT, db=REDIS_DB), } } -# Channels settings (use db #0 of redis) +# Channels settings CHANNEL_LAYERS = { "default": {