diff --git a/Makefile b/Makefile index 9386033b..36b5110c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ install: ## Install the dependencies .PHONY: develop develop: ## Install the test and dev dependencies - python3 -m pip install -e .[test,dev] + python3 -m pip install -e .[test,dev,sync] playwright install .PHONY: format diff --git a/pyproject.toml b/pyproject.toml index abe266ab..665d6a8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,13 +34,11 @@ dependencies = [ "django-probes==1.7.0", "Pillow==11.0.0", "psycopg==3.2.3", - "pydantic==2.9.2", "requests==2.32.3", "rcssmin==1.1.3", "rjsmin==1.2.3", "social-auth-core==4.5.4", "social-auth-app-django==5.4.2", - "websockets==13.1", ] [project.optional-dependencies] @@ -67,6 +65,12 @@ test = [ docker = [ "uwsgi==2.0.27", ] +sync = [ + "channels==4.1.0", + "daphne==4.1.2", + "pydantic==2.9.2", + "websockets==13.1", +] [project.scripts] umap = "umap.bin:main" diff --git a/umap/asgi.py b/umap/asgi.py new file mode 100644 index 00000000..2ca12ddc --- /dev/null +++ b/umap/asgi.py @@ -0,0 +1,15 @@ +import os + +from channels.routing import ProtocolTypeRouter +from django.core.asgi import get_asgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umap.settings") +# Initialize Django ASGI application early to ensure the AppRegistry +# is populated before importing code that may import ORM models. +django_asgi_app = get_asgi_application() + +application = ProtocolTypeRouter( + { + "http": django_asgi_app, + } +) diff --git a/umap/settings/base.py b/umap/settings/base.py index 73a1bf71..c00ef253 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -19,7 +19,7 @@ env = environ.Env() INTERNAL_IPS = env.list("INTERNAL_IPS", default=["127.0.0.1"]) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"]) ADMINS = tuple(parseaddr(email) for email in env.list("ADMINS", default=[])) - +ASGI_APPLICATION = "umap.asgi.application" DEBUG = env.bool("DEBUG", default=False)