摘要:
async def text_audio(text, audio_name): tts = edge_tts.Communicate( text=text, voice="zh-CN-XiaoxiaoNeural") await tts.save(audio_name) audio_name = " 阅读全文
摘要:
""" 多圈电机转动模式1 """ def decimal_to_hex_bytes(decimal_number, byte_size): # 检查字节大小参数的有效性 valid_sizes = {"int8": 1, "int16": 2, "int32": 4, "int64": 8} if 阅读全文
摘要:
import threading from datetime import datetime from peewee import Model, PostgresqlDatabase, AutoField, DateTimeField from playhouse.shortcuts import 阅读全文
摘要:
import asyncio import aioredis from config.env_config import REDIS_URL class RedisClient: def __init__(self, url, decode_responses=True, max_connectio 阅读全文
摘要:
package main import "fmt" const ( defaultName string = "张建平" defaultAge int = 27 defaultHigh int = 175 ) type User struct { Name string Age int High i 阅读全文
摘要:
version: "3" services: halo: image: halohub/halo:2.6 container_name: halo restart: on-failure:3 depends_on: halodb: condition: service_healthy network 阅读全文
摘要:
目前就想到了这两种 drf框架返回接口数据的时候返回count接口数据随着数据的增多查询缓慢! 1. 不返回总数据,前端采用下拉刷新方式获取 2. 主键采用int类型,每次返回最后一条数据id数即为总数(first().id - last().id + 1) from collections imp 阅读全文
摘要:
import cv2 from func_timeout import func_set_timeout, exceptions def check_rtsp_stream(url): @func_set_timeout(2) def parse_rtsp_stream(rtsp_address): 阅读全文
摘要:
import os import re import netifaces import subprocess class NetWorkConfig: def __init__(self): pass @staticmethod def check_network_isvalid(ip, netma 阅读全文
摘要:
效果图↓ 需要配置↓ index.html↓ <!DOCTYPE html> {% load i18n static %} {% load simpletags %} {% load customtags %} {% get_current_language as LANGUAGE_CODE %}{ 阅读全文
摘要:
起源于一个比较奇葩的需求,默认的celery无法实现: 需要用户输入一个开始时间,结束时间,以及时间间隔,需要在该时间段内指定间隔执行 import datetime def task(start: datetime.datetime, end: datetime.datetime, interva 阅读全文
摘要:
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import mode 阅读全文
摘要:
1. 新增middleware.py中间件: 需要在setting.py注册 class LoggingMiddleware: """ 日志记录模块: 操作用户、操作ip、请求路径、请求方式、请求时间 """ def __init__(self, get_response): self.get_re 阅读全文
摘要:
import socket def get_local_ip(): """ 获取本机 IP 地址: 通用 """ try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('8.8.8.8', 80)) ip = s.g 阅读全文
摘要:
1. 创建middleware.py class InternalIPMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): # 获取请求头 阅读全文