umap/umap/asgi.py
Alexis Métaireau 71943c0ab3 chore: use asgi rather than wsgi
By relying on Django Channels and Daphne.
This requires a change in how the application is deployed to take that into account.
2024-10-14 12:04:44 +02:00

16 lines
497 B
Python

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,
# Just HTTP for now. (We can add other protocols later.)
}
)