ASGI_APPLICATION ="django_template_v1.routing.application"CHANNEL_LAYERS ={"default":{# This example apps uses the Redis channel layer implementation channels_redis"BACKEND":"channels_redis.core.RedisChannelLayer","CONFIG":{"hosts":["{}0".format(REDIS_URL)],},},}
2. 跟settings.py同级目录下,添加routing.py文件
fromdjango.urls import path, re_path
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from apps.message_manage.consumers import ChatConsumer, NotificationChatConsumer# QueryAuthMiddlewareStack、AuthMiddlewareStackapplication = ProtocolTypeRouter({"websocket": URLRouter([re_path(r'^ws/chat/(?P<recipient>\w+)/$', ChatConsumer),# re_path(r'^ws/chatting/(?P<recipient>\w+)/$', NotificationChatConsumer),re_path(r'^ws/chatting/(?P<recipient>\w+)/(?P<platform_key>\w+)/$', NotificationChatConsumer),]),})
3. 跟settings.py同级目录下,添加asgi.py文件
"""
ASGI config for django_template_v1 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/3.2/howto/deployment/asgi/
"""import os
importdjangofrom channels.routing import get_default_applicationos.environ.setdefault('DJANGO_SETTINGS_MODULE','django_template_v1.settings')django.setup()
application = get_default_application()
Android获取状态栏的高度:
方法一:通过资源名称获取, getDimensionPixelSize,获取系统中"status_bar_height"的值,方法如下:
Java:
public static int getStatusBarHeight(Context…
1、建立分区表
执行 tb_intercept_notice表-重建-添加分区.sql 文件;
DROP TABLE IF EXISTS tb_intercept_notice_20241101_new;
CREATE TABLE tb_intercept_notice_20241101_new (id char(32) NOT NULL COMMENT id,number varchar(30) NOT NULL COMMENT 号码,cre…