Skip to content

Commit

Permalink
수정: asgi application 설정
Browse files Browse the repository at this point in the history
- ws 요청 websocket
- http 요청 asgi
  • Loading branch information
Sahayana committed Nov 22, 2023
1 parent ffdecd2 commit 6e22a38
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions alaltalk/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,21 @@

import os

import django
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.sessions import SessionMiddlewareStack
from django.core.asgi import get_asgi_application

# import apps.chat.routing
from apps.chat.routing import websocket_urlpatterns

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alaltalk.settings.dev")
django.setup()

# chat.router를 root router로 설정
# application = ProtocolTypeRouter(
# {
# "http": get_asgi_application(),
# "websocket": SessionMiddlewareStack(
# URLRouter(apps.chat.routing.websocket_urlpatterns)
# ),
# }
# )

application = get_asgi_application()
application = ProtocolTypeRouter(
{
"http": get_asgi_application(),
"websocket": SessionMiddlewareStack(URLRouter(websocket_urlpatterns)),
}
)

0 comments on commit 6e22a38

Please sign in to comment.