【发布时间】:2018-01-28 09:17:15
【问题描述】:
我将 Flask 与 React 一起使用。我想创建一个类似于这样的捕获所有路线(尽管这不起作用):
@app.route('*')
def get():
return render_template('index.html')
由于我的应用程序将使用 React 并且它使用 index.html 来挂载我的 React 组件,我希望每个路由请求都指向我在模板中的 index.html 页面。有没有办法做到这一点(或者使用重定向是最好的方式)?
【问题讨论】: