当我在@app.before_request 中使用flash() 时,我得到了看似随机数量的重复条目。一遍又一遍地刷新页面会给我 1 到 4 条重复消息。
没有任何重定向。
我的代码很简单:
if app.config['INSTANCE'] == 'DEV':
flash("This data is from the development DB")
或者,我无法弄清楚如何通过 get_flashed_messages() 访问/修改 flash() 似乎附加到模板之外的消息数组。有谁知道怎么做?