Skip to content

Instantly share code, notes, and snippets.

@xtornasol512
Last active August 24, 2017 17:39
Show Gist options
  • Save xtornasol512/a989887642620e818fdb89cbdea8deb3 to your computer and use it in GitHub Desktop.
Save xtornasol512/a989887642620e818fdb89cbdea8deb3 to your computer and use it in GitHub Desktop.
Django Redis conf
# Redis apps
redis==2.10.5
rq==0.7.0
django-redis==4.7.0
django-rq==0.9.4
django-rq-email-backend==0.1.3
INSTALLED_APPS = [
...
# Django Redis
'django_rq',
'django_rq_email_backend',
]
#Use Console Backend email when DEBUG = True, and SSLEmail backend with Django RQ when is not Debug = True
EMAIL_BACKEND = 'django_rq_email_backend.backends.RQEmailBackend'
if DEBUG:
RQ_EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
else:
RQ_EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
#Redis Cache
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {
# config for pool connections
"max_connections": 10
}
}
}
}
# Redis Config
RQ_QUEUES = {
'default': {
'USE_REDIS_CACHE': 'default',
},
'high': {
'USE_REDIS_CACHE': 'default',
},
'low': {
'USE_REDIS_CACHE': 'default',
}
}
# extra config args for RQ
RQ = {
#RQ_EXCEPTION_HANDLERS = ['']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment