栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在Google App Engine Python应用程序的模块之间共享会话?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在Google App Engine Python应用程序的模块之间共享会话?

默认情况下,webapp2_extra.sessions使用基于Cooki的会话。这些将绑定到特定域。您的模块可能位于module1.yourapp.appspot.com和module2.yourapp.appspot.com(猜测)。第二个模块将看不到第一个模块设置的cookie。

在您的配置中,尝试设置cookie的域。

config['webapp2_extras.sessions'] = {    'secret_key': 'my-super-secret-key',     cookie_args': {          'domain' : "yourapp.appspot.com"}

文档说:

 - domain: Domain of the cookie. To work accross subdomains the   domain must be set to the main domain with a preceding dot, e.g.,   cookies set for `.mydomain.org` will work in `foo.mydomain.org` and   `bar.mydomain.org`. Default is None, which means that cookies will   only work for the current subdomain.

来自:https :
//pre.google.com/p/webapp-
improved/source/browse/webapp2_extras/sessions.py

或者,您也可以使用其他后端之一,例如内存缓存或数据存储区。如果您的会话包含敏感信息,则首选此方法。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/660079.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号