重新启动后仍会出现Python烧瓶闪存消息异常

use*_*036 7 python flask

我正在制作一个小烧瓶应用程序,我有这样的东西:

@app.route('/bye')
def logout():
    session.pop('logged_in', None)
    flash('Adiós')
    return redirect('/index')
Run Code Online (Sandbox Code Playgroud)

毋庸置疑,当我运行应用程序并导航到'/ bye'时,它给了我一个UnicodeDecodeError.好吧,现在它在每个扩展基本模板(呈现消息)的页面上都给了我相同的unicodedecodeerror,即使在重新启动应用程序之后也是如此.尽管在源代码中删除了闪存,但始终使用相同的dump().我能想到的只是废话?请帮忙.

好吧,我不得不重新启动计算机以清除愚蠢的会话缓存或其他东西.

cod*_*eek 15

我认为flash()实际上创建了一个名为session ['_ flashes']的会话.请在此处查看此代码.所以你可能要么:

clear/delete the cookie 
Run Code Online (Sandbox Code Playgroud)

要么

session.pop('_flashes', None)
Run Code Online (Sandbox Code Playgroud)