""" ASGI config for server project. HTTP is handled by Django as usual; websocket connections are routed to the scene consumers so peers receive live scene deltas. """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings') # 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)), })