如何清除烧瓶会话? [英] How do I clear a flask session?

查看:74
本文介绍了如何清除烧瓶会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导入烧瓶时,我们导入诸如session等的模块.

While importing flask, we import modules such as session etc.

SecureCookieSession是一种字典,可以使用会话进行访问.

SecureCookieSession is a kind of dictionary, that can be accessed using session.

现在,我尝试清除尝试构建网站时使用的所有垃圾变量.

Now, I try to clear all the junk variables that I used while trying to build a website.

关于stackoverflow的答案之一使用了像session.clear()这样的命令来清除会话的内容.但是,这样的命令会产生错误,表明不存在这样的命令.

One of the answers on stackoverflow used a command like session.clear() for clearing the contents of a session. But such a command gives an error that no such command exists.

有人能为我指出如何在每次关闭服务器或关闭网站时清除SecureCookieSession以及如何清除会话吗?

Can anyone point out for me how to clear the SecureCookieSession and how to clear the session every time I shutdown the server or close the website?

推荐答案

无法进行clear会话或其他任何方法.

There is no way to clear session or anything.

只需更改app.config["SECRET_KEY"],会话字典中的内容就会被删除.

One must simply change the app.config["SECRET_KEY"] and the contents in session dictionary will get erased.

这篇关于如何清除烧瓶会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆