【发布时间】:2014-11-30 05:22:28
【问题描述】:
您好,我正在从 Udacity 进行 Web 开发,并在 python 中试验 google 数据存储,并创建了一个名为 Blog 的简单实体。
我检查了 localhost:admin 端口,所有的 id 都像 '5249205949956096',应该是 '1','2','3' 而不是其他人。这应该与我的文本编辑器有关还是除了代码之外的其他设置错误?
class Blog(db.Model):
subject = db.StringProperty(required = True)
content = db.TextProperty(required =True)
created = db.DateTimeProperty(auto_now_add = True)
class NewPostHandler(Handler):
def get(self):
self.render("newpost.html")
def post(self):
subject = self.request.get("subject")
content = self.request.get("content")
if subject and content:
newblog=Blog(subject=subject,content=content)
newblog_key = newblog.put()
【问题讨论】:
-
实际上是 Long,而不是 String。
标签: python database google-app-engine unicode google-cloud-datastore