Tornado 模板配置 及静态资源的配置
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
settings = {
"template_path": os.path.join(BASE_DIR, "templates"),
"static_path" : os.path.join(BASE_DIR, "static"),
}
application = Application([
...
], **settings)
静态资源配置方式2
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
application = Application([
(r"/static/(.*)", StaticFileHandler, path= os.path.join(BASE_DIR, "static")),
], **settings)