""" ASGI config for car_inventory project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ """ # asgi.py import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "car_inventory.settings") import django django.setup() from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from channels.auth import AuthMiddlewareStack from inventory.notifications.sse import NotificationSSEApp from django.urls import re_path from django.core.asgi import get_asgi_application # BASE_DIR = Path(__file__).resolve().parent.parent app = get_asgi_application() application = ProtocolTypeRouter( { "http": AuthMiddlewareStack( URLRouter( [ path("sse/notifications/", NotificationSSEApp()), re_path(r"", app), ] ) ), } ) # if django.conf.settings.DEBUG: # application = ASGIStaticFilesHandler(app)