示例#1
0
文件: webapp.py 项目: fczuardi/teh
def main():
    application = webapp.WSGIApplication([
        (r"/teh/", HomePageHandler),
        (r"/teh/login", LoginHandler),
        (r"/teh/logout", LogoutHandler),

        (r"/teh/entries", teh.blog.EntryIndexHandler),
        (r"/teh/feed", teh.blog.FeedHandler),
        (r"/teh/entry/([^/]+)", teh.blog.EntryHandler),
        (r"/teh/entry/([^/]+)/edit", teh.blog.NewEntryHandler),
        (r"/teh/entry/([^/]+)/del", teh.blog.EntryDeleteHandler),
        (r"/teh/([^/]+)/edit", teh.blog.NewEntryHandler),
        (r"/teh/([^/]+)/del", teh.blog.EntryDeleteHandler),
        (r"/teh/topic/([^/]+)", teh.blog.TagHandler),
        
        (r"/teh/admin", teh.admin.AdminHandler),
        (r"/teh/admin/new", teh.blog.NewEntryHandler),
        (r"/teh/admin/config", teh.admin.ConfigHandler),
        (r"/teh/admin/entrylist", teh.admin.EntryListHandler),

       # (r"/shooin/([^/]+)", shooin.ShooinHandler),
        (r"/teh/([^/]+)", teh.blog.PageHandler),
        ], debug=True)
    
    config = TehConfig.all()
    if config.count() > 0:
        config = config.fetch(1)[0]
    else: 
        config1 = TehConfig(title="TEH Blog")
        config1.put()
       
    wsgiref.handlers.CGIHandler().run(application)
示例#2
0
文件: admin.py 项目: fczuardi/teh
 def post(self):
     config = TehConfig.all()
     config = config.fetch(1)[0]
     config.title = self.request.get("title")
     config.disqus = self.request.get("disqus")
     config.put()
     self.redirect('../admin')