From 9e2881a65938e067294e20a62d87d9ff271077a9 Mon Sep 17 00:00:00 2001 From: Jaehun You Date: Tue, 26 Nov 2024 10:42:24 +0900 Subject: [PATCH] Move initializing cache to `asgi.py` See also: #17 --- wlm_server/wlm_server/asgi.py | 4 ++++ wlm_server/wlm_server/wsgi.py | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wlm_server/wlm_server/asgi.py b/wlm_server/wlm_server/asgi.py index 27448be..38a979b 100644 --- a/wlm_server/wlm_server/asgi.py +++ b/wlm_server/wlm_server/asgi.py @@ -11,6 +11,7 @@ from django.core.asgi import get_asgi_application from django.urls import path +from django.conf import settings from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter from channels.security.websocket import AllowedHostsOriginValidator @@ -18,8 +19,11 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wlm_server.settings') # pylint: disable=wrong-import-position +from cache.channel import ChannelCache from operation.consumers import OperationConsumer +settings.CHANNEL_CACHE = ChannelCache() + application = ProtocolTypeRouter( { 'http': get_asgi_application(), diff --git a/wlm_server/wlm_server/wsgi.py b/wlm_server/wlm_server/wsgi.py index 755efc0..a86a901 100644 --- a/wlm_server/wlm_server/wsgi.py +++ b/wlm_server/wlm_server/wsgi.py @@ -16,6 +16,4 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wlm_server.settings') -settings.CHANNEL_CACHE = ChannelCache() - application = get_wsgi_application()