From 3717cd8b3f8bf32337fd96cc83bd541d1e163373 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 28 Mar 2023 20:24:42 +0200 Subject: [PATCH] Don't import models too soon Signed-off-by: Emmy D'Anello --- tfjm/asgi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tfjm/asgi.py b/tfjm/asgi.py index 938e79f..126040c 100644 --- a/tfjm/asgi.py +++ b/tfjm/asgi.py @@ -17,13 +17,15 @@ from channels.routing import ProtocolTypeRouter, URLRouter from channels.security.websocket import AllowedHostsOriginValidator from django.core.asgi import get_asgi_application -import draw.routing - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tfjm.settings') +django_asgi_app = get_asgi_application() + +import draw.routing + application = ProtocolTypeRouter( { - "http": get_asgi_application(), + "http": django_asgi_app, "websocket": AllowedHostsOriginValidator( AuthMiddlewareStack(URLRouter(draw.routing.websocket_urlpatterns)) ),