mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-04 02:52:15 +02:00
First play with websockets
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
14
tfjm/asgi.py
14
tfjm/asgi.py
@ -12,8 +12,20 @@ https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
|
||||
|
||||
import os
|
||||
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from channels.security.websocket import AllowedHostsOriginValidator
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
import draw.routing
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tfjm.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
application = ProtocolTypeRouter(
|
||||
{
|
||||
"http": get_asgi_application(),
|
||||
"websocket": AllowedHostsOriginValidator(
|
||||
AuthMiddlewareStack(URLRouter(draw.routing.websocket_urlpatterns))
|
||||
),
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user