【发布时间】:2016-08-10 00:24:11
【问题描述】:
我正在处理一个项目。我想在用户登录时设置一个 cookie,以便记住他们。但是我已经尝试了互联网上的所有方法,从 Google 到 Stack Overflow。我似乎找不到有效的方法。
我试过了:
class Main(webapp2.RequestHandler):
def get(self):
print "Set-Cookie: testing=test123cookie"
print "Content-Type: text/html\n"
那没有用。然后尝试:
import Cookie
class Main(webapp2.RequestHandler):
def get(self):
cookie = Cookie.SimpleCookie()
cookie['lastvisit'] = "test"
print cookie
print 'Content-Type: text/html\n'
令人惊讶的是,它也不起作用。我该怎么办?我该怎么做?我敢肯定我只是愚蠢而没有做正确的事情。
谢谢。
【问题讨论】:
标签: python google-app-engine cookies