27 lines
637 B
Python
27 lines
637 B
Python
"""
|
|
ASGI config for chat project.
|
|
|
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
"""
|
|
|
|
import os
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
|
|
|
|
from django.core.asgi import get_asgi_application
|
|
|
|
django_asgi_app = get_asgi_application()
|
|
|
|
from channels.auth import AuthMiddlewareStack
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
|
|
from apps.chat.websocket.routing import websocket_urlpatterns
|
|
|
|
application = ProtocolTypeRouter(
|
|
{
|
|
"http": django_asgi_app,
|
|
"websocket": AuthMiddlewareStack(
|
|
URLRouter(websocket_urlpatterns)
|
|
),
|
|
}
|
|
)
|