在AWS Fargate上部署后,flask-swagger-ui不起作用

时间:2020-11-05 14:20:23

标签: python amazon-web-services flask swagger

flask-swagger-ui在AWS Fargate上部署后不起作用。 As someone pointed out in this question,我需要将swagger.yml放在/static内的app.root_path文件夹内,这是我要做的事情:

SWAGGER_URL = '/dev/api/docs'
API_URL = '/static/swagger.yml'


swaggerui_blueprint = get_swaggerui_blueprint(
    SWAGGER_URL,
    API_URL,
    config={
        'app_name': "API"
    }
)

app.register_blueprint(swaggerui_blueprint)

在localhost上,当我访问http://localhost:5000/dev/api/docs/时,即使在构建docker映像并在本地运行它之后,它也能正常工作。问题是当我实际将docker映像部署到AWS Fargate时。该API正常工作(负载均衡器上的/dev/api/*),但是当我访问文档时,找不到/static/swagger.yml

enter image description here

关于可能是什么问题的任何想法?

编辑:完全错误

{
  "schemaValidationMessages": [
    {
      "level": "error",
      "message": "Can't read from file http://URL/static/swagger.yml"
    }
  ]
}

0 个答案:

没有答案