我用的是flask-restful,webargs,marshmallow和flasgger。我的代码看起来像这样:
#flasgger_yamlsv2 dir is in resources, so is this method
@swag_from('flasgger_yamlsv2/xyz.yml')
#MySchema is a marshmallow schema
@use_args(MySchema())
def get(self, args):
data = method1(args)
json.loads(data)加载apidocs url时,将在lib/python3.6/site-package/webargs中查找模板。当我将flasgger_yamlsv2移动到那个位置时,一切正常。但是我不想这样做。我希望将它们作为src的一部分,而不是lib。
发布于 2019-11-06 20:47:08
我的回答可能有点天真,但是"file:“指令不就是您的问题的答案吗?
@app.route('/colors/<palette>/')
def colors(palette):
"""
file: colors.yml
"""
...https://stackoverflow.com/questions/58510708
复制相似问题