def __init__(self): self.application = tornado.web.Application( handlers=urls.get_handlers(), template_path=settings["template_path"], debug=False, gzip=True, compiled_template_cache=False) self.server = tornado.httpserver.HTTPServer(self.application)
def __init__(self): self.application = tornado.web.Application( handlers=urls.get_handlers(), template_path=settings["template_path"], debug=False, gzip=True, compiled_template_cache=False ) self.server = tornado.httpserver.HTTPServer(self.application)
def __init__(self): handlers = get_handlers() # 获取所有的url及handler # 初始化app tornado.web.Application.__init__( self, handlers, **settings) # create db object, use `self.application.db` to get it. conn = MongoClient('localhost', 27017) self.db = conn.test_database # 建立全文索引 self.db.blog.create_index("centent")