feat: websockets
CI / test (push) Successful in 1m56s
CI / build (push) Successful in 48s

This commit is contained in:
2026-07-31 14:27:50 +02:00
parent 125c9dd186
commit 393b39cacd
13 changed files with 626 additions and 2 deletions
+16 -1
View File
@@ -4,4 +4,19 @@ from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
application = get_asgi_application()
# get_asgi_application() llama a django.setup(): tiene que ejecutarse antes de
# importar routing/consumers, porque estos importan modelos.
django_asgi_app = get_asgi_application()
from channels.auth import AuthMiddlewareStack # noqa: E402
from channels.routing import ProtocolTypeRouter, URLRouter # noqa: E402
from channels.security.websocket import AllowedHostsOriginValidator # noqa: E402
from backoffice.routing import websocket_urlpatterns # noqa: E402
application = ProtocolTypeRouter(
{
'http': django_asgi_app,
'websocket': AllowedHostsOriginValidator(AuthMiddlewareStack(URLRouter(websocket_urlpatterns))),
}
)