chat v3
This commit is contained in:
SDE
2023-08-11 23:25:28 +03:00
parent aeb90e106e
commit 78ade08e65
7 changed files with 83 additions and 4 deletions

View File

@@ -10,7 +10,17 @@ https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from ChatServiceApp.websocket_urls import websocket_urlpatterns
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TWB.settings')
application = get_asgi_application()
application = ProtocolTypeRouter({
'http': get_asgi_application(),
'websocket': AuthMiddlewareStack(
URLRouter(
websocket_urlpatterns
)
)
})

View File

@@ -33,6 +33,7 @@ ALLOWED_HOSTS = ["*"]
# Application definition
INSTALLED_APPS = [
'channels',
'modeltranslation',
'django.contrib.admin',
@@ -85,8 +86,8 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = 'TWB.wsgi.application'
# WSGI_APPLICATION = 'TWB.wsgi.application'
ASGI_APPLICATION = 'TWB.asgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases