chat qo'shildi
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
asgi_application = get_asgi_application()
|
||||
from config.env import env # noqa
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
|
||||
|
||||
|
||||
application = asgi_application
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||
|
||||
asgi_application = get_asgi_application()
|
||||
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter # noqa
|
||||
from django.urls import re_path # noqa
|
||||
|
||||
from core.apps.chat.consumers import ChatConsumer # noqa
|
||||
from core.apps.chat.middlewares.auth import JWTAuthMiddlewareStack # noqa
|
||||
|
||||
websocket_urlpatterns = [
|
||||
re_path(
|
||||
r"^ws/chat/room/(?P<room_id>\d+)/$",
|
||||
ChatConsumer.as_asgi(),
|
||||
),
|
||||
]
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
"http": asgi_application,
|
||||
"websocket": JWTAuthMiddlewareStack(
|
||||
URLRouter(websocket_urlpatterns)
|
||||
),
|
||||
})
|
||||
|
||||
@@ -1 +1 @@
|
||||
MODULES = ["core.apps.shared", "core.apps.evaluation", "core.apps.payment"]
|
||||
MODULES = ["core.apps.shared", "core.apps.evaluation", "core.apps.payment", "core.apps.chat"]
|
||||
|
||||
@@ -128,6 +128,17 @@ PAGES = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"title": _("Chat"),
|
||||
"separator": True,
|
||||
"items": [
|
||||
{
|
||||
"title": _("Chat xabarlari"),
|
||||
"icon": "chat",
|
||||
"link": reverse_lazy("admin:chat_chatmessagemodel_changelist"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"title": _("Ma'lumotnomalari"),
|
||||
"separator": True,
|
||||
|
||||
@@ -148,8 +148,18 @@ AUTH_USER_MODEL = "accounts.User"
|
||||
CELERY_BROKER_URL = env("REDIS_URL")
|
||||
CELERY_RESULT_BACKEND = env("REDIS_URL")
|
||||
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [env("REDIS_URL")],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
ALLOWED_HOSTS += env("ALLOWED_HOSTS").split(",")
|
||||
CSRF_TRUSTED_ORIGINS = env("CSRF_TRUSTED_ORIGINS").split(",")
|
||||
SITE_URL = env.str("SITE_URL", default="http://localhost:8055")
|
||||
|
||||
|
||||
MODELTRANSLATION_LANGUAGES = ("uz", "ru", "en")
|
||||
|
||||
@@ -22,6 +22,7 @@ urlpatterns = [
|
||||
path("api/", include("core.apps.shared.urls")),
|
||||
path("api/v1/", include("core.apps.evaluation.urls")),
|
||||
path("api/v1/", include("core.apps.payment.urls")),
|
||||
path("api/v1/", include("core.apps.chat.urls")),
|
||||
]
|
||||
urlpatterns += [
|
||||
path("admin/", admin.site.urls),
|
||||
|
||||
Reference in New Issue
Block a user