代码拉取完成,页面将自动刷新
import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define,options
from mydb import TornaDB
from urls import urls
import cfg
from tool import UUID
define("port", default=8081, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init__(self):
handlers = urls
settings = dict(
template_path = os.path.join(os.path.dirname(__file__), "templates"),
static_path = os.path.join(os.path.dirname(__file__), "static"),
blog_title = u"我的博客",
cookie_secret = UUID.get_uuid(),
login_url = "/signin",
debug = options.debug,
autoescape=None,
compress_whitespace=False,
)
tornado.web.Application.__init__(self, handlers, **settings)
self.db = TornaDB.Connection(host=options.db_host,
port=options.db_port,
database=options.db_database,
user=options.db_user,
password=options.db_pass
)
if __name__ == "__main__":
cfg.set_define()
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.current().start()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。