zoukankan      html  css  js  c++  java
  • Tornado模板配置

     1 #!/usr/bin/env python
     2 # -*- coding:utf-8 -*-
     3 #tornado模板配置
     4 import tornado.ioloop
     5 import tornado.web
     6 class MainHandler(tornado.web.RequestHandler):
     7     def get(self):
     8         self.render("a1.html")
     9         # self.write("a1.html")
    10 settings ={
    11     'template_path':'tpl',#html文件模板路径配置
    12     'static_path':'static'#css,js文件路径配置
    13 }
    14 application = tornado.web.Application([
    15         (r"/index", MainHandler),
    16         ],**settings)
    17 if __name__ == "__main__":
    18     application.listen(8000)
    19     tornado.ioloop.IOLoop.instance().start()
    a1.html
    1
    <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 <link rel="stylesheet" href="static/commons.css"> 7 </head> 8 <body> 9 <a>s1</a> 10 </body> 11 </html>

    commons.css
    body{
    margin: 0;

    }
     

  • 相关阅读:
    java 第二次作业
    Java上机作业5.7
    Java上机作业4.30
    Java第八周作业
    上机作业4.23
    第七周作业
    4.16上机作业
    第六周作业
    Java上机作业4.9
    Java4.2上机作业
  • 原文地址:https://www.cnblogs.com/shiluoliming/p/6543419.html
Copyright © 2011-2022 走看看