debug3
This commit is contained in:
11
api/asgi.py
11
api/asgi.py
@@ -9,9 +9,16 @@ https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
|
||||
|
||||
import os
|
||||
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
from .urls import ws_urlpatterns
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings")
|
||||
|
||||
application =get_asgi_application()
|
||||
application = ProtocolTypeRouter(
|
||||
{
|
||||
"http": get_asgi_application(),
|
||||
"websocket": AuthMiddlewareStack(URLRouter(ws_urlpatterns)),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ from django.urls import path
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from ninja import NinjaAPI
|
||||
from .ws import Consumer
|
||||
|
||||
api = NinjaAPI()
|
||||
|
||||
@@ -34,4 +35,8 @@ apis = [
|
||||
path("api/", api.urls),
|
||||
]
|
||||
|
||||
urlpatterns = apis + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns = apis + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
ws_urlpatterns = [
|
||||
path("ws/", Consumer.as_asgi()),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user