23 lines
613 B
Python
23 lines
613 B
Python
import os
|
|
from django.core.asgi import get_asgi_application
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
from channels.auth import AuthMiddlewareStack
|
|
from django.urls import re_path
|
|
|
|
from project import consumers
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
|
|
|
|
websocket_urlpatterns = [
|
|
re_path(r'ws/video_stream/$', consumers.VideoStreamConsumer.as_asgi()),
|
|
]
|
|
|
|
application = ProtocolTypeRouter({
|
|
"http": get_asgi_application(),
|
|
"websocket": AuthMiddlewareStack(
|
|
URLRouter(
|
|
websocket_urlpatterns
|
|
)
|
|
),
|
|
})
|
|
CORS_ORIGIN_ALLOW_ALL = True |