Google App Engine Python - Using the Datastore



我手动输入了提到的代码@https://developers.google.com/appengine/docs/python/gettingstarted/usingdatastore在 helloworld.py

我正在运行dev_appserver.py服务器,访问 localhost:8080 没有显示任何内容。

如果我插入调试消息,如@ http://pastebin.com/VtCMjrk8

我看到下面的输出@本地主机:8080"问候(db.模型( 启动主函数(( 主页类 guestbook_key 函数 状态: 200 OK 内容类型: 文本/html;字符集=utf-8 缓存控制:无缓存 到期: 星期五, 01 一月 1990 00:00:00 GMT 内容长度: 12 ">

我使用的是Windows Vista Basic 32位。

更新:真不敢相信。如果我复制粘贴代码 https://developers.google.com/appengine/docs/python/gettingstarted/usingdatastore在 helloworld.py 中,我确实看到了所需的输出。

可能是什么问题?

2(

也https://developers.google.com/appengine/docs/python/gettingstarted/usingusers输出@ localhost:8080显示hello +,而不是允许我选择或输入用户名

可能是什么原因?

你可能输入了错误的东西。 使用调试器并单步执行代码以找出不起作用的内容。

为什么手动键入的代码不起作用而剪切粘贴代码起作用的原始问题的答案是,类 MainPage 中的最后一条语句(如下所示(需要在 For 级别缩进(因此它将不在 For 循环中(。在 Python 中,缩进很重要!!

self.response.out.write("""  .......

最新更新