tornado

s1.py

import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.render('s1.html')
settings={
    'template_path':'tpl',
    'static_path': 'static',
}
application = tornado.web.Application([
    (r"/index", MainHandler),
],**settings)

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

tpl s1.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="static/s1.css">
</head>
<body>
<h1 class="w">111</h1>
</body>
</html>

static s1.css

 .w{
            color: aqua;
        }

快速上手tornado

posted @ 2018-01-16 19:05  口水哥  阅读(233)  评论(0编辑  收藏  举报