forked from DGNum/gestioCOF
use new settings for redis
This commit is contained in:
parent
673dc0295d
commit
e7266e7a9d
1 changed files with 5 additions and 24 deletions
|
@ -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 + '/<num_db>'
|
||||
|
||||
|
||||
# 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": {
|
||||
|
|
Loading…
Reference in a new issue