Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从烧瓶会话字典中删除一个键,如下所示:
del session["host"]
主机密钥被删除(我通过打印对此进行了测试),但是当页面被重定向时,如果重新出现(我通过删除它然后在另一个请求中打印它来做到这一点)。我怎样才能解决这个问题?如果你想要我,我会发布完整的代码。(我在隐身浏览器中使用相同的选项卡)
您可以尝试执行以下操作:
session.pop("host",None)
我从Python Flask 中 Session.pop 方法的第二个参数做什么?
app.route()我在具有装饰器的函数之外修改了字典。确保使用装饰器在函数内部对其进行修改。
app.route()