ejemplo-de-chat-con-Django/mi_web/asgi.py

19 lines
442 B
Python
Raw Normal View History

2020-11-17 23:42:59 +01:00
import os
2020-11-15 10:52:18 +01:00
2020-11-17 23:42:59 +01:00
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mi_web.settings")
import django
2020-11-15 10:52:18 +01:00
2020-11-17 23:42:59 +01:00
django.setup()
2020-11-15 10:52:18 +01:00
2020-11-17 23:42:59 +01:00
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
2020-11-15 10:52:18 +01:00
from django.core.asgi import get_asgi_application
2020-11-17 23:42:59 +01:00
from apps.chat.routing import websocket_urlpatterns
2020-11-15 10:52:18 +01:00
2020-11-17 23:42:59 +01:00
application = ProtocolTypeRouter(
{
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
}
)