websoket qoshildi
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
import django
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.base')
|
||||
|
||||
application = get_asgi_application()
|
||||
django.setup()
|
||||
|
||||
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 core.apps.authentication.websocket.consumers import UserActivationConsumer
|
||||
|
||||
django_asgi_app = get_asgi_application()
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
'http': django_asgi_app,
|
||||
'websocket': AuthMiddlewareStack(
|
||||
URLRouter([
|
||||
re_path(r'^ws/user_activation/(?P<user_id>\d+)/$', UserActivationConsumer.as_asgi()),
|
||||
])
|
||||
),
|
||||
})
|
||||
@@ -1,4 +1,5 @@
|
||||
from .rest_framework import *
|
||||
from .corsheaders import *
|
||||
from .simple_jwt import *
|
||||
from .drf_yasg import *
|
||||
from .drf_yasg import *
|
||||
from .redis import *
|
||||
10
config/conf/redis.py
Normal file
10
config/conf/redis.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from config.env import env
|
||||
|
||||
CHANNEL_LAYERS = {
|
||||
'default': {
|
||||
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
||||
'CONFIG': {
|
||||
"hosts": [(env.str('REDIS_HOST'), env.str('REDIS_PORT'))],
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -61,6 +61,7 @@ TEMPLATES = [
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
ASGI_APPLICATION = 'config.asgi.application'
|
||||
|
||||
|
||||
DATABASES = {
|
||||
|
||||
Reference in New Issue
Block a user