Files
api/api/asgi.py
2025-12-30 11:27:14 +07:00

19 lines
512 B
Python

import os
# Set the settings module before any other Django-related imports.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings')
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
import app.routing
application = ProtocolTypeRouter({
"http": get_asgi_application(),
"websocket": AuthMiddlewareStack(
URLRouter(
app.routing.websocket_urlpatterns
)
),
})