在flask中使用swagger(flasgger使用方法及效果展示)

一. 部分代码及效果

from flask import Flask
from flasgger import Swagger

import config

app = Flask(__name__)
app.config.from_object(config)

swagger_config = Swagger.DEFAULT_CONFIG
swagger_config['title'] = config.SWAGGER_TITLE    # 配置大标题
swagger_config['description'] = config.SWAGGER_DESC    # 配置公共描述内容
swagger_config['host'] = config.SWAGGER_HOST    # 请求域名

# swagger_config['swagger_ui_bundle_js'] = '//unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js'
# swagger_config['swagger_ui_standalone_preset_js'] = '//unpkg.com/swagger-ui-dist@3/swagger-ui-standalone-preset.js'
# swagger_config['jquery_js'] = '//unpkg.com/[email protected]/dist/jquery.min.js'
# swagger_config['swagger_ui_css'] = '//unpkg.com/swagger-ui-dist@3/swagger-ui.css'
Swagger(app, config

你可能感兴趣的:(python,运维,javascript,ViewUI)