Fixed issue of not connecting to redis instance and added caching for courses

This commit is contained in:
Keannu Christian Bernasol 2023-09-12 19:42:32 +08:00
parent 7053f1d487
commit 0215680ea5
4 changed files with 26 additions and 2 deletions

View file

@ -261,11 +261,30 @@ LEAFLET_CONFIG = {
'TILES': 'https://openstreetmap.keannu1.duckdns.org/tile/{z}/{x}/{y}.png'
}
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
REDIS_PORT = os.getenv('REDIS_PORT', 6379)
# Django Redis Cache
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://redis:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"
# Redis Cache for Django Channel Websockets
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
"hosts": [("redis", 6379)],
},
},
}