html-over-websockets-with-d.../event/asgi.py

27 lines
663 B
Python
Raw Normal View History

2021-11-08 23:32:13 +01:00
"""
ASGI config for event project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
2021-11-12 18:59:01 +01:00
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "event.settings")
import django
django.setup()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
2021-11-08 23:32:13 +01:00
from django.core.asgi import get_asgi_application
2021-11-12 18:59:01 +01:00
from app.website.routing import websocket_urlpatterns
2021-11-08 23:32:13 +01:00
2021-11-12 18:59:01 +01:00
application = ProtocolTypeRouter(
{
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
}
)