From 8dd20dde3fc12f318469fb70dfbb48f5cca2a1ed Mon Sep 17 00:00:00 2001 From: Shayan Khan Date: Tue, 21 Nov 2023 17:16:23 -0600 Subject: [PATCH] bug/django 4 webhook fix (#909) * testing webhook fix * cleanup --- server/portal/asgi.py | 9 ++++++++- server/portal/routing.py | 12 ------------ 2 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 server/portal/routing.py diff --git a/server/portal/asgi.py b/server/portal/asgi.py index ebf8cdd9a4..1b243c0422 100644 --- a/server/portal/asgi.py +++ b/server/portal/asgi.py @@ -5,12 +5,19 @@ import os import django -from channels.routing import ProtocolTypeRouter +from channels.routing import ProtocolTypeRouter, URLRouter from django.core.asgi import get_asgi_application +from channels.auth import AuthMiddlewareStack +import portal.apps.notifications.routing os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portal.settings.settings') django.setup() application = ProtocolTypeRouter({ "http": get_asgi_application(), + "websocket": AuthMiddlewareStack( + URLRouter( + portal.apps.notifications.routing.websocket_urlpatterns + ) + ) }) diff --git a/server/portal/routing.py b/server/portal/routing.py deleted file mode 100644 index fecf2a9fd9..0000000000 --- a/server/portal/routing.py +++ /dev/null @@ -1,12 +0,0 @@ -from channels.auth import AuthMiddlewareStack -from channels.routing import ProtocolTypeRouter, URLRouter -import portal.apps.notifications.routing - -application = ProtocolTypeRouter({ - # (http->django views is added by default) - 'websocket': AuthMiddlewareStack( - URLRouter( - portal.apps.notifications.routing.websocket_urlpatterns - ) - ), -})