Commits

ben  committed 00325a3

清空缓存

  • Participants
  • Parent commits 6797bea

Comments (0)

Files changed (2)

 import random
 import urllib
 import os
-from google.appengine.api import urlfetch
+from google.appengine.api import urlfetch,memcache
 from google.appengine.ext import webapp
 from google.appengine.ext.webapp import util
 from util.handler import AdminHandler,get_or_404
                                                     method=urlfetch.POST,
                                                     )
         self.response.out.write(result.content)
+
+class FlushMemcacheHandler(AdminHandler):
+    def post(self):
+        memcache.flush_all()
+        self.redirect("/a/settings/")
         
 def main():
     application = webapp.WSGIApplication ([
                                         ('/a/twitter/',TwitterMainHandler),
                                         ('/a/twitter/verify/',TwitterVerifyHandler),
                                         ('/a/twitter/update/',TwitterUpdateHandler),
+                                        
+                                        ('/a/flush/',FlushMemcacheHandler),
                                         ],
                                          debug=settings.DEBUG)
     util.run_wsgi_app(application)

File themes/admin/settings.html

     </p>
 </fieldset>
 </form>
+
+<h3>清除缓存</h3>
+<form method="post" action="/a/flush/" class="f">
+<fieldset>
+    <p>
+        <input type="submit" value="清除缓存">
+    </p>
+</fieldset>
+</form>
 {% endblock %}