mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-25 04:43:43 +03:00
21 lines
597 B
Python
21 lines
597 B
Python
import os
|
|
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
from django.conf import settings
|
|
from django.core.asgi import get_asgi_application
|
|
|
|
from akarpov.common.channels import HeaderAuthMiddleware
|
|
from config import routing
|
|
|
|
if settings.DEBUG:
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
|
else:
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
|
|
|
application = ProtocolTypeRouter(
|
|
{
|
|
"http": get_asgi_application(),
|
|
"websocket": HeaderAuthMiddleware(URLRouter(routing.websocket_urlpatterns)),
|
|
}
|
|
)
|