Files
boss_dp/server/asgi.py
Your Name 2e143fb0c0 哈哈
2026-02-14 16:50:02 +08:00

21 lines
553 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""
ASGI 入口HTTP (Django) + WebSocket (Channels)。
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings")
import django # noqa: E402
django.setup() # noqa: E402
from channels.routing import ProtocolTypeRouter, URLRouter # noqa: E402
from django.core.asgi import get_asgi_application # noqa: E402
from server.ws.routing import websocket_urlpatterns # noqa: E402
application = ProtocolTypeRouter({
"http": get_asgi_application(),
"websocket": URLRouter(websocket_urlpatterns),
})