1
wuxqing 2014 年 6 月 1 日
|
2
shinerene OP 恩 我知道这个 但是应该怎么在主代码中使用这个interface和session呢?能说一下实际该怎么应用么
|
3
dagger 2014 年 6 月 1 日
初始化之后不用再管SessionInterface了吧,session使用的话,教程里就有啊
http://flask.pocoo.org/docs/quickstart/#sessions |
4
shinerene OP @dagger 可是我用help()看了session,Session是不一样的,Session是SecureCookieSession类,而session是定义在global类中的,为localproxy()。这两个我在应用的时候应该用Session吧
|
5
dagger 2014 年 6 月 2 日
flask通过特殊手段让一些全局变量来代理当前上下文的相关变量:
http://flask.pocoo.org/docs/appcontext/ http://werkzeug.pocoo.org/docs/local/ 原理细节你可以自己去探究,不过使用的时候你连教程都不相信,那也没办法了。。 |
7
dagger 2014 年 6 月 3 日
用起来一样的,flask的模块化设计非常好,默认的session也只不过是SessionMixin、SessionInterface的一个实现罢了(SecureCookieSession、SecureCookieSessionInterface)
|