2026-06-28 23:45:49 -04:00
|
|
|
"""
|
|
|
|
|
ASGI config for server project.
|
|
|
|
|
|
2026-06-29 10:52:46 -04:00
|
|
|
HTTP is handled by Django as usual; websocket connections are routed to the
|
|
|
|
|
scene consumers so peers receive live scene deltas.
|
2026-06-28 23:45:49 -04:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from django.core.asgi import get_asgi_application
|
|
|
|
|
|
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
|
|
|
|
|
|
2026-06-29 10:52:46 -04:00
|
|
|
# Initialise Django before importing anything that touches the app registry.
|
|
|
|
|
django_asgi_app = get_asgi_application()
|
|
|
|
|
|
|
|
|
|
from channels.auth import AuthMiddlewareStack
|
|
|
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
|
|
|
|
|
|
|
|
import scenes.routing
|
|
|
|
|
|
|
|
|
|
application = ProtocolTypeRouter({
|
|
|
|
|
'http': django_asgi_app,
|
|
|
|
|
'websocket': AuthMiddlewareStack(URLRouter(scenes.routing.websocket_urlpatterns)),
|
|
|
|
|
})
|