![](/img/trans.png)
[英]Swagger in Django rest function based api does not show properly on ubuntu server (production)
[英]django REST swagger function based api does not have input PARAMETERS
我正在按照這些說明大膽地做基於Django REST函數的API。
https://github.com/m-haziq/django-rest-swagger-docs
但是,我無法獲得函數中顯示的任何參數。 這是不顯示任何參數的屏幕截圖。 https://imgur.com/a/fDITT https://imgur.com/a/n5CDU
更新:這就是我要使用參數https://imgur.com/a/cLYNF實現的方式
這是我的API代碼,我想在招搖中顯示“名稱”參數https://gitlab.com/firdausmah/railercom/blob/master/railercomapp/api.py
@api_view(['POST'])
def test_post(request):
# ----- YAML below for Swagger -----
"""
description: This API deletes/uninstalls a device.
parameters:
- name: name
type: string
required: true
location: form
"""
name = request.POST.get('name')
return Response("Data Saved!", status=status.HTTP_201_CREATED)
這是我的點子凍結庫與django-rest-swagger-docs https://gist.github.com/anonymous/c5c328b9e4a6ff3f86676fe930440dd2的工作示例的區別
有什么問題,您可以在gitlab中查看整個源代碼。 謝謝。
我在自述文件中找到了這個
*Input parameters for function based views do not appear:* You might be using
incompatible versions, try using `djangorestframework==3.5.3` and `django-rest-swagger==2.1.1`.
我更新為djangorestframework == 3.5.3並且它有效
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.