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
:
关于可能是什么问题的任何想法?
编辑:完全错误
{
"schemaValidationMessages": [
{
"level": "error",
"message": "Can't read from file http://URL/static/swagger.yml"
}
]
}