我一直在試圖運行此查詢:調試GQL查詢
my_post = db.GqlQuery("SELECT * FROM Post where __key__ = KEY('Post', 1)")
self.render("showpost.html", my_post = my_post)
和我的模板showpost.html
看起來是這樣的:
<div class="post">
<h3 class="post-subject">{{ my_post.subject }}</h3>
<div class="post-content">{{ my_post.content }}</div>
</div
非但沒有的id=1
後的細節我得到一個空白頁。雖然存在id = 1的帖子,但我不確定如何確認GQLquery是否實際返回了某些內容。有沒有辦法檢查? 在嘗試以下操作:
my_post = db.GqlQuery("SELECT * FROM Post where subject = 'hello_world')
self.render("showpost.html", my_post = my_post)
我得到了同樣的問題(空白頁),即使有後誰的主題是hello_world
非常感謝
感謝您的提示。我會用這個來代替。非常感謝 :) – Prakhar