简体   繁体   English

如何仅在django-rest-swagger包中显示一些URL文档

[英]how to show only some URL documentation in django-rest-swagger package

I am using Django-rest-swagger Package for documenting my API but I want to show only some URLs to document I have several apps in my project - some answers are USE Exclude but latest version it is not working - I am using djangorestframework==3.5.1 and Django-rest-swagger==2.1.0 and Django-rest-framework for API. 我正在使用Django-rest-swagger软件包来记录我的API,但是我只想显示一些URL来记录我项目中有多个应用程序-一些答案是USE排除,但最新版本不起作用-我正在使用djangorestframework==3.5.1 API的djangorestframework==3.5.1Django-rest-swagger==2.1.0Django-rest-framework

I even tried render-schema and get_swagger_view(title='API Documentation', patterns=urlpatterns1) . 我什至尝试了render-schema和get_swagger_view(title='API Documentation', patterns=urlpatterns1)

but it's not working. 但它不起作用。

help me to find a solution. 帮助我找到解决方案。

Set exclude_from_schema = True in your View/Viewset or add it to the decorator (if you use them). 在您的视图/视图集中设置exclude_from_schema = True或将其添加到装饰器(如果使用它们)。 This will exclude the view from swagger docs. 这会将视图从招摇的文档中排除。

django-rest-swagger has changed a lot, in earlier versions there were settings for exclutish urls by name or namespace. django-rest-swagger发生了很大变化,在早期版本中,存在按名称或名称空间设置专有URL的设置。 Currently you need to exclude the View from the schema drf is generating, it's documented here http://www.django-rest-framework.org/api-guide/views/#api_view . 当前,您需要从drf生成的架构中排除视图,该文档记录在http://www.django-rest-framework.org/api-guide/views/#api_view中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM