forked from esamarathon/donation-tracker-toplevel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asgi.py
34 lines (25 loc) · 918 Bytes
/
asgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
ASGI config for tracker_development project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tracker_development.settings')
django_app = get_asgi_application()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.security.websocket import AllowedHostsOriginValidator
from django.urls import path
import tracker.routing
application = ProtocolTypeRouter({
'http': django_app,
'websocket': AllowedHostsOriginValidator(
AuthMiddlewareStack(
URLRouter(
[path('tracker/', URLRouter(tracker.routing.websocket_urlpatterns))]
)
)
),
})