先贴上Application这个类的源码. class Application(httputil.HTTPServerConnectionDelegate): """A collection of request handlers that make up a web application. Instances of this class are callable and can be passed directly to HTTPServer to serve the a…
安装jinja2包 pip install jinja2 定义继承tornado.web.RequestHandler的子类BaseHandler.如果请求处理类继承这个类将会使用jinja模板引擎:如果请求处理类继承tornado.web.RequestHandler,则会使用Tornado框架的模板引擎. import os from jinja2 import Environment, FileSystemLoader, TemplateNotFound from tornado.web…