当前位置:网站首页>Swagger实现后台接口自动化文档
Swagger实现后台接口自动化文档
2022-06-25 17:33:00 【hrj199036】
一、安装
pip install drf-yasg
二、配置
- 在setting.py中INSTALLED_APPS添加drf-yasg
INSTALLED_APPS = [
...
'drf_yasg',
...
]
- 在路由中urls中添加
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from django.conf import settings
from django.conf.urls.static import static
schema_view = get_schema_view(
openapi.Info(
title='API接口文档平台',#必传
default_version="v1", #必传
description = '这个一接口文档',
terms_of_service = "",
contact=openapi.Contact(email='[email protected]'),
license = openapi.License(name='BSD License'),
),
public = True,
# permission_classes = (permissions.AllowAny),#权限类py
)
urlpatterns = [
...
path('docs/',schema_view.with_ui('swagger',cache_timeout=0),name='schema-swagger-ui'),
...
]
urlpatterns += static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT)
边栏推荐
- 十大龙头券商 办理开户安全吗
- golang sort slice int
- Under the same WiFi, the notebook is connected to the virtual machine on the desktop
- 【UVM实战 ===> Episode_2 】~ VIP、VIP的开发、VIP的发布
- College Students' hot summer exchange, Rog star product phantom 16 flipped version / phantom 13 / phantom x appointment
- 【UVM实战 ===> Episode_1 】~ MCDF设计更新、AMBA标准接口、UVM验证环境更新
- 深入理解ELF文件
- Can I open an account? Is it safe to open an account
- 宝藏又小众的国画3d材质贴图素材网站分享
- Precautions for use of Jerry's SPI slave [chapter]
猜你喜欢

揭秘GES超大规模图计算引擎HyG:图切分
![[matlab] curve fitting](/img/58/3fdcc4d34e7c7c71b73324517ff69d.png)
[matlab] curve fitting
![[matlab] data interpolation](/img/b8/d7e1a5f7c6f56c8312a1fb5d517ac6.png)
[matlab] data interpolation

Learning Tai Chi makers - mqtt (I) what is mqtt

CVPR small target detection: context and attention mechanisms improve small target detection (attached with paper Download)

观察者模式之通用消息发布与订阅

杰理之系统时钟设置出现复位或无效问题【篇】
![Jerry's addition of encrypted file playback function [chapter]](/img/d0/b7a0c9030c157f282405129be51efe.png)
Jerry's addition of encrypted file playback function [chapter]

喜报|海泰方圆通过CMMI-3资质认证,研发能力获国际认可

杰理之如何给外界输出一个时钟源使用【篇】
随机推荐
Essential characteristics of convolution operation +textcnn text classification
杰理之定时器捕获(timer_cap.c)使用注意事项【篇】
Treasure and niche Chinese painting 3D texture material website sharing
使用DiskGenius拓展系統盤C盤的容量
什么是算子?
十大龙头券商 办理开户安全吗
杰理之如何给外界输出一个时钟源使用【篇】
RuntimeError: Trying to backward through the graph a second time (or directly access saved variable
Create a new ar fashion experience with cheese and sugar beans
杰理之增加加密文件播放功能【篇】
Is Guotai Junan Securities reliable? Is it legal? Is it safe to open a stock account?
[matlab] data statistical analysis
Can I open an account? Is it safe to open an account
杰理之获取复位源和唤醒的 IO 口的方法【篇】
BILSTM和CRF的那些事
Learning Tai Chi maker mqtt (II) basic principles of mqtt
golang sort slice int
Huawei cloud gaussdb (for redis) unveiling issue 19: gaussdb (for redis) comprehensive comparison with CODIS
Utilisation de diskgenius pour augmenter la capacité du disque système C
HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast