<small id='yjpBR'></small><noframes id='yjpBR'>

  • <i id='yjpBR'><tr id='yjpBR'><dt id='yjpBR'><q id='yjpBR'><span id='yjpBR'><b id='yjpBR'><form id='yjpBR'><ins id='yjpBR'></ins><ul id='yjpBR'></ul><sub id='yjpBR'></sub></form><legend id='yjpBR'></legend><bdo id='yjpBR'><pre id='yjpBR'><center id='yjpBR'></center></pre></bdo></b><th id='yjpBR'></th></span></q></dt></tr></i><div id='yjpBR'><tfoot id='yjpBR'></tfoot><dl id='yjpBR'><fieldset id='yjpBR'></fieldset></dl></div>
  • <legend id='yjpBR'><style id='yjpBR'><dir id='yjpBR'><q id='yjpBR'></q></dir></style></legend>

      <tfoot id='yjpBR'></tfoot>

          <bdo id='yjpBR'></bdo><ul id='yjpBR'></ul>

        从 Django REST Swagger 中排除 URL

        时间:2023-09-28

        <small id='JVnZ5'></small><noframes id='JVnZ5'>

              <tbody id='JVnZ5'></tbody>
            1. <i id='JVnZ5'><tr id='JVnZ5'><dt id='JVnZ5'><q id='JVnZ5'><span id='JVnZ5'><b id='JVnZ5'><form id='JVnZ5'><ins id='JVnZ5'></ins><ul id='JVnZ5'></ul><sub id='JVnZ5'></sub></form><legend id='JVnZ5'></legend><bdo id='JVnZ5'><pre id='JVnZ5'><center id='JVnZ5'></center></pre></bdo></b><th id='JVnZ5'></th></span></q></dt></tr></i><div id='JVnZ5'><tfoot id='JVnZ5'></tfoot><dl id='JVnZ5'><fieldset id='JVnZ5'></fieldset></dl></div>

                <legend id='JVnZ5'><style id='JVnZ5'><dir id='JVnZ5'><q id='JVnZ5'></q></dir></style></legend>
                  <bdo id='JVnZ5'></bdo><ul id='JVnZ5'></ul>
                  <tfoot id='JVnZ5'></tfoot>

                  本文介绍了从 Django REST Swagger 中排除 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想从我的 REST API 文档中排除一些 URL.我正在使用 Django REST Swagger 和我能找到的唯一文档 (https://github.com/marcgibbons/django-rest-swagger) 并没有真正告诉我太多.settings.py 中有 SWAGGER_SETTINGS 的exclude_namespaces"部分,但没有真正的解释或示例说明如何使用它.

                  I have a few URLs that I want to exclude from my REST API documentation. I'm using Django REST Swagger and the only documentation I can find (https://github.com/marcgibbons/django-rest-swagger) doesn't really tell me much. There is the "exclude_namespaces" part of SWAGGER_SETTINGS in settings.py, but there is no real explanation or example of how to use this.

                  简单地说,我想从文档中排除以以下内容开头的所有 URL:

                  Simply put, I want to exclude any URLs from the docs that start with the following:

                  /api/jobs/status/
                  /api/jobs/parameters/
                  

                  我该怎么做呢?

                  提前感谢您提供的任何帮助:P

                  Thanks in advance for any help offered :P

                  推荐答案

                  要排除的命名空间是您的 urls.py 中定义的命名空间.

                  the namespaces to exclude are the one defined in your urls.py.

                  例如,在你的情况下:

                  urls.py:

                  internal_apis = patterns('',
                                       url(r'^/api/jobs/status/',...),
                                       url(r'^/api/jobs/parameters/',...),
                                       )
                  
                  urlpatterns = urlpatterns + patterns('',
                                url(r'^', include(internal_apis, namespace="internal_apis")),
                                ...
                                )
                  

                  在你的 settings.py 中:

                  and in your settings.py:

                  SWAGGER_SETTINGS = {
                      "exclude_namespaces": ["internal_apis"],    #  List URL namespaces to ignore
                  }
                  

                  这在那里有很好的描述

                  这篇关于从 Django REST Swagger 中排除 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何测试 Connexion/Flask 应用程序? 下一篇:Python 连接不显示 Swagger UI

                  相关文章

                  <i id='34Acl'><tr id='34Acl'><dt id='34Acl'><q id='34Acl'><span id='34Acl'><b id='34Acl'><form id='34Acl'><ins id='34Acl'></ins><ul id='34Acl'></ul><sub id='34Acl'></sub></form><legend id='34Acl'></legend><bdo id='34Acl'><pre id='34Acl'><center id='34Acl'></center></pre></bdo></b><th id='34Acl'></th></span></q></dt></tr></i><div id='34Acl'><tfoot id='34Acl'></tfoot><dl id='34Acl'><fieldset id='34Acl'></fieldset></dl></div>

                      • <bdo id='34Acl'></bdo><ul id='34Acl'></ul>
                      <tfoot id='34Acl'></tfoot>

                      <small id='34Acl'></small><noframes id='34Acl'>

                    1. <legend id='34Acl'><style id='34Acl'><dir id='34Acl'><q id='34Acl'></q></dir></style></legend>