mirror of
https://github.com/Django-LiveView/demo-alarms
synced 2026-01-08 06:23:32 +01:00
- Organize imports alphabetically - Add noqa comments for E402 violations (imports after django.setup()) - Maintain correct execution order for Django initialization
24 lines
724 B
Python
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()),
|
|
])
|
|
),
|
|
})
|