Files
agentic-soc-platform/ASP/asgi.py
T
2025-12-18 21:01:51 +08:00

32 lines
736 B
Python

# -*- coding: utf-8 -*-
# @File : asgi.py
# @Date : 2019/10/3
# @Desc :
"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ASP.settings')
django.setup()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
websocket_urlpatterns = [
]
application = ProtocolTypeRouter({
"http": get_asgi_application(), # Django's WSGI application handles HTTP requests
"websocket": AuthMiddlewareStack(
URLRouter(
websocket_urlpatterns # WebSocket handling
)
),
})