From b3e88b6096eed1d28d33c90d69836dd22c619ede Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 14 Oct 2024 12:10:13 +0200 Subject: [PATCH] chore: make daphne/asgi optional for now --- pyproject.toml | 6 ++++-- umap/asgi.py | 14 +------------- umap/settings/base.py | 1 - 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e36038b5..8155bc55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,6 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [ - "channels==4.0.0", - "daphne==4.1.0", "Django==5.1.1", "django-agnocomplete==2.2.0", "django-environ==0.11.2", @@ -69,6 +67,10 @@ test = [ docker = [ "uwsgi==2.0.27", ] +sync = [ + "channels==4.1.0", + "daphne==4.1.2", +] [project.scripts] umap = "umap.bin:main" diff --git a/umap/asgi.py b/umap/asgi.py index f81d24d3..00487a9c 100644 --- a/umap/asgi.py +++ b/umap/asgi.py @@ -1,10 +1,7 @@ import os -from channels.auth import AuthMiddlewareStack -from channels.routing import ProtocolTypeRouter, URLRouter -from channels.security.websocket import AllowedHostsOriginValidator +from channels.routing import ProtocolTypeRouter from django.core.asgi import get_asgi_application -from django.urls import re_path os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umap.settings") # Initialize Django ASGI application early to ensure the AppRegistry @@ -15,14 +12,5 @@ application = ProtocolTypeRouter( { "http": django_asgi_app, # Just HTTP for now. (We can add other protocols later.) - "websocket": AllowedHostsOriginValidator( - AuthMiddlewareStack( - URLRouter( - [ - re_path(r"^ws/$", consumers.AsyncChatConsumer.as_asgi()), - ] - ) - ) - ), } ) diff --git a/umap/settings/base.py b/umap/settings/base.py index 81131b9a..c00ef253 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -119,7 +119,6 @@ LANGUAGES = ( SECRET_KEY = env("SECRET_KEY", default=None) INSTALLED_APPS = ( - "daphne", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions",