You need to do four things:
Run:
pip install django-cacheback
and add cacheback
to your INSTALLED_APPS
.
The 'django-celery' package will be installed by pip as part of step 1, but you will also need to complete the djcelery installation process by adding djcelery
to your INSTALLED_APPS
and including:
import djcelery
djcelery.setup_loader()
in your settings.
Celery requires a message broker. Use Celery's tutorial to help set one up. I recommend rabbitmq.
You also need to ensure you have a cache set up. Most likely, you'll be using memcache so your settings will include something like:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
You may also want to configure logging handlers for the 'cacheback' named logger. To set up console logging, use something like:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
}
},
'loggers': {
'cacheback': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': False,
},
}
}