Pycket会话管理器不在tornad中工作

2024-09-30 10:43:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用Pycket会话管理器在会话中设置值。看看代码:

session = SessionManager(self)
session['key'] = 'OMG'

之后,在另一个处理程序中,我使用了以下代码:

^{pr2}$

它写None!我该怎么办?在

注意:redis在我的项目中运行良好,这是我的龙卷风设置:

if __name__ == "__main__":
    tornado.options.parse_command_line()
    app = tornado.web.Application(
        url_patterns,debug=True,
        cookie_secret="61oETz3455545gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
        xsrf_cookies= False,
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path= os.path.join(os.path.dirname(__file__), "static"),

        **{
                'pycket': {
                    'engine': 'redis',
                    'storage': {
                        'db_sessions': 10,
                        'db_notifications': 11,
                        'max_connections': 2 ** 31,
                        },
                    'cookies': {
                        'expires_days': 120,
                        # 'domain' : SharedConnections.SiteNameUrl[SharedConnections.SiteNameUrl.index(".")+1,-1],
                        'domain' : 'domain.com',

                        },
                    },
                }
    )

Tags: path代码redisdbossessiondomainstatic

热门问题