From 1644fa54034b704c5ddc06f0a654a99a7ccd059c Mon Sep 17 00:00:00 2001 From: Alexander-D-Karpov Date: Wed, 29 Nov 2023 17:36:33 +0300 Subject: [PATCH] updated local compose --- config/asgi.py | 12 +++++++++--- local.yml | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config/asgi.py b/config/asgi.py index eef501c..67f33a2 100644 --- a/config/asgi.py +++ b/config/asgi.py @@ -4,8 +4,14 @@ from django.conf import settings from django.core.asgi import get_asgi_application -from akarpov.common.channels import HeaderAuthMiddleware -from config import routing +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") +# Initialize Django ASGI application early to ensure the AppRegistry +# is populated before importing code that may import ORM models. +django_asgi_app = get_asgi_application() + + +from akarpov.common.channels import HeaderAuthMiddleware # noqa +from config import routing # noqa if settings.DEBUG: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") @@ -14,7 +20,7 @@ application = ProtocolTypeRouter( { - "http": get_asgi_application(), + "http": django_asgi_app, "websocket": HeaderAuthMiddleware(URLRouter(routing.websocket_urlpatterns)), } ) diff --git a/local.yml b/local.yml index 16be2fa..fb97d1c 100644 --- a/local.yml +++ b/local.yml @@ -19,6 +19,7 @@ services: - mailhog - elasticsearch volumes: + - /var/www/media:/app/akarpov/media - .:/app:z env_file: - ./.envs/.local/.django