安装 swaggerpip install drf_yasg setting.py 添加 swaggerINSTALLED_APPS = [ .... 'drf_yasg', ] 总路由配置 url.py# 配置 swagger from drf_yasg.views import get_schema_view from drf_yasg import openapi from rest_framework import permissions schema_view = get_schema_view( openapi.Info( ...

阅读全文>>

安装依赖yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y 下载安装#下载安装包 wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz #解压 tar -zxvf Python-3.9.1...

阅读全文>>

一般的安装步骤1 安装依赖库pip3 install django-debug-toolbar 2 settings.py中 将 debug_toolbar 添加到 INSTALL_APPS 中INSTALLED_APPS = [ 'django.contrib.staticfiles', … 'debug_toolbar',# 注册debug_toolbar,放在django.contrib.staticfiles后面 ] 3 settings.py中 在中间件中加入DebugToolbarMiddlewareMIDDLEWARE = [ # ... '...

阅读全文>>

1 安装依赖包pip install coreapi 2 seting.py的文件配置REST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema', } 3 url的配置from django.conf.urls import url from rest_framework.documentation import include_docs_urls url(r'^docs/', include_docs_urls(title='接口文档')), 4 访问http://127.0.0....

阅读全文>>

setting添加配置 AUTHENTICATION_BACKENDS = ( 'users.views.CustomBackend', # 'django.contrib.auth.backends.ModelBackend', ) users.views.CustomBackendfrom django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend, BaseBackend from django.db.models import...

阅读全文>>

报错的测试$data = rtrim("揭西县","县"); print($data); 返回结果异常 处理汉字编码的问题$tmp = mb_substr("揭西县",0,-1*mb_strlen("县")); print($tmp); 总结 线上的一个报错,汉字编码的问题,记录下吧,遇到汉字记得使用 mb_func类的函数

阅读全文>>

配置文件 # sql日志记录 LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { 'format': '%(levelname)s...

阅读全文>>

[该文章已设置加密,请点击标题输入密码访问]

Testspm.test("Status code is 200", function () { pm.response.to.have.status(200); }); var data = JSON.parse(responseBody); // 把responseBody转为json字符串 if (data.data.access) { tests["Body has token"] = true; pm.environment.set("Authorization", data.data.access); // 设置环境变量token...

阅读全文>>

redis_db 连接数据库 import redis try: pool = redis.ConnectionPool( host="localhost", port=6379, password="123456", db=0, max_connections=200 ) except Exception as e: print(e) thread 多线程操作 from concurrent.futures import ThreadPoolExecutor from redis_db import pool impo...

阅读全文>>