chore: make daphne/asgi optional for now

This commit is contained in:
Yohan Boniface 2024-10-14 12:10:13 +02:00
parent aa246aaf05
commit b3e88b6096
3 changed files with 5 additions and 16 deletions

View file

@ -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"

View file

@ -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()),
]
)
)
),
}
)

View file

@ -119,7 +119,6 @@ LANGUAGES = (
SECRET_KEY = env("SECRET_KEY", default=None)
INSTALLED_APPS = (
"daphne",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",