backend/config/asgi.py

30 lines
755 B
Python
Raw Normal View History

2021-10-28 10:12:20 +00:00
"""
ASGI config for config 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
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
2021-10-28 10:12:20 +00:00
from django.core.asgi import get_asgi_application
import websocket.routing
2021-10-28 10:12:20 +00:00
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
2022-05-20 17:14:48 +00:00
django_asgi_app = get_asgi_application()
2021-10-28 10:12:20 +00:00
2022-05-20 17:14:48 +00:00
#application = get_asgi_application()
application = ProtocolTypeRouter({
"http": django_asgi_app,
"websocket": AuthMiddlewareStack(
URLRouter(
websocket.routing.websocket_urlpatterns
)
),
2022-05-20 17:14:48 +00:00
})