mirror of
https://github.com/taskPyroer/DjangoVue3Admin.git
synced 2026-10-08 18:09:02 +00:00
24 lines
798 B
Python
24 lines
798 B
Python
"""
|
|
ASGI config for application 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/4.2/howto/deployment/asgi/
|
|
"""
|
|
|
|
import os
|
|
import django
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings')
|
|
django.setup() # 使用daphne启动的时候需要设置,不然会报错django.core.exceptions.ImproperlyConfigured
|
|
|
|
from channels.auth import AuthMiddlewareStack
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
from django.core.asgi import get_asgi_application
|
|
from application.routing import websocket_urlpatterns
|
|
|
|
application = ProtocolTypeRouter({
|
|
"http": get_asgi_application(),
|
|
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns))
|
|
})
|