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

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

      1. <small id='fBI7G'></small><noframes id='fBI7G'>

        如何配置“HTTPS"?带有 drf-yasg 自动生成的招摇页面的方案?

        时间:2023-09-28

          • <tfoot id='A04Bu'></tfoot>
              <tbody id='A04Bu'></tbody>

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

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

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

                  <legend id='A04Bu'><style id='A04Bu'><dir id='A04Bu'><q id='A04Bu'></q></dir></style></legend>
                  本文介绍了如何配置“HTTPS"?带有 drf-yasg 自动生成的招摇页面的方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I know in a traditional swagger YAML file, we can define the schemes with:

                  schemes:
                    - http
                    - https
                  
                  //OR
                  
                  schemes: [http, https]
                  

                  However, how can I do the same thing with auto-generated swagger page with the drf-yasg library?

                  Now, the generated swagger page only contains HTTP schemes, but HTTPS is missing. I've tried set the DEFAULT_API_URL in setting.py to https://mybaseurl.com, but it seems not to be working.

                  解决方案

                  There is a solution.

                  When defining get_schema_view() in urls.py, use this code:

                  schema_view = get_schema_view(
                      openapi.Info( ... ),
                      url='https://example.net/api/v1/', # Important bit
                      public=True,
                      permission_classes=(permissions.AllowAny,)
                  )
                  

                  Note: You can either use https or http because of that better use this solution with an environment variable for different setups.

                  这篇关于如何配置“HTTPS"?带有 drf-yasg 自动生成的招摇页面的方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Django Rest Framework:如何为基于函数的视图启用 swagger 文档 下一篇:Django REST Framework Swagger - 身份验证错误

                  相关文章

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

                  2. <small id='hKqIm'></small><noframes id='hKqIm'>

                    <legend id='hKqIm'><style id='hKqIm'><dir id='hKqIm'><q id='hKqIm'></q></dir></style></legend>

                      <tfoot id='hKqIm'></tfoot>