dkoug Blog

Settings for redis and cache

Django -- Posted on Dec. 1, 2017

Settings for redis and cache

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import djcelery
djcelery.setup_loader()
BROKER_URL = 'redis://localhost:6379/0'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'

CACHES = {
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': '/var/run/redis/redis.sock',
        'TIMEOUT': 60
    },
}