Files
demo-alarms/config/asgi.py
Andros Fenollosa c16914e16e Fix ruff linting errors in asgi.py
- Organize imports alphabetically
- Add noqa comments for E402 violations (imports after django.setup())
- Maintain correct execution order for Django initialization
2025-12-09 08:49:39 +01:00

24 lines
724 B
Python

import os
import django
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
from django.urls import path
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
django.setup()
# Import handlers to ensure they are registered (must be after django.setup())
import alerts.liveview_components.alerts # noqa: E402, F401
from liveview.consumers import LiveViewConsumer # noqa: E402
application = ProtocolTypeRouter({
"http": get_asgi_application(),
"websocket": AuthMiddlewareStack(
URLRouter([
path('ws/liveview/<str:room_name>/', LiveViewConsumer.as_asgi()),
])
),
})