0

我使用谷歌應用程序引擎編寫了一個應用程序。這是一個簡單的博客系統。如果我刪除了一篇博客,則該頁面沒有按照我的意願刷新。它仍然顯示已被刪除的博客。但如果在此之後刷新頁面,它將以正確的方式呈現。我雖然這是緩存的問題。我一直在爲它工作了幾天。任何人都可以教我如何解決它?非常感謝。爲什麼我的頁面沒有顯示最新的數據

class BlogFront(BlogHandler): 
    def get(self): 
     val = self.request.get("newPost") 
     #get all the pages 
     posts = Post.all().order('-created') 
     #stop the cache in the browser 
     self.response.headers["Pragma"]="no-cache" 
     self.response.headers["Cache-Control"]="no-cache, no-store, must-revalidate, pre-check=0, post-check=0" 
     self.response.headers["Expires"]="Thu, 01 Dec 1994 16:00:00" 
     self.render('front.html', posts = posts) 

    def post(self): 
     #press the delete button 
     operatorRequest = self.request.get('Delete') 
     articleId = operatorRequest.split('|')[0] 
     operator = operatorRequest.split('|')[1] 
     key = db.Key.from_path('Post', int(articleId), parent=blog_key()) 
     post = db.get(key) 
     db.delete(post.key()) 
     self.redirect("/") 
+0

要刷新本頁面,它是在瀏覽器窗口?它怎麼會知道它應該刷新自己? –

回答

相關問題