使用iron-ajax Polymer Web组件加载本地json文件时,返回的响应是index.html的内容,而不是json文件 .

<iron-ajax auto url="data.json" on-response="handleResponse" handle-as="json"></iron-ajax>

我正在“网络”下检查Chrome开发者工具中的响应,并且给出的响应与index.html文件相同 . 我使用Polymer 2.0入门套件作为前端,后端有Flask . 抱歉,如果这是一个简单的错误,但我是JavaScript的新手 .

我的简化文件结构如下:

/app
 |-- app.py
 |-- /static
      |-- index.html
      |-- /bower_components
      |-- /src
           |-- data.json *(file to be loaded)*
           |-- my-app.html
           |-- my-view.html *(view to load file)*

编辑:我认为这个问题可能与我正在使用的锅炉板的app.py文件中的这个catch-all有关 . 我意识到我不明白相对网址在这个应用程序中是如何工作的 .

@app.route("/static/<path:path>")
def static_c(path):
    return current_app.send_static_file(path)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
    return current_app.send_static_file("index.html")