1.reset_framework
1.1安装rest_framework
1.2使用rest_framework
在django框架中setting文件中注册rest_framework
INSTALLED_APPS = [
'rest_framework',
]

2.reset_framework+swagger
2.1.安装drf_yasg
2.2.在django框架中setting文件中注册drf_yasg
INSTALLED_APPS = [
'drf_yasg',
]
2.3.在setting文件中新增如下配置
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
# os.path.join(BASE_DIR, 'templates'),
# os.path.join(BASE_DIR, 'drf-yasg', 'templates'),
# os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.re

最低0.47元/天 解锁文章

418

被折叠的 条评论
为什么被折叠?



