1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 01:58:23 +02:00

Add Redis Channel Layer for the drawing system

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-11 23:05:58 +02:00
parent 0e7a275a28
commit 8245ba0063
5 changed files with 121 additions and 33 deletions

View File

@ -79,6 +79,11 @@ if "test" not in sys.argv: # pragma: no cover
'mailer',
]
if os.getenv("TFJM_STAGE", "dev") == "prod": # pragma: no cover
INSTALLED_APPS += [
'channels_redis',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@ -268,7 +273,6 @@ FORBIDDEN_TRIGRAMS = [
"SEX",
]
# TODO: Use a redis server in production
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"

View File

@ -30,3 +30,12 @@ CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False
X_FRAME_OPTIONS = 'DENY'
SESSION_COOKIE_AGE = 60 * 60 * 3
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(os.getenv('REDIS_SERVER_HOST', 'localhost'), os.getenv('REDIS_SERVER_PORT', 6379))],
},
},
}