Tornado
|- static
|- script (javascript)
|- styles (css)
|- templates
|- index.html
========= python 소스 ====================================
import os
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
(r"/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), 'static')}),
],
template_path=os.path.join(os.path.dirname(__file__), "templates"))
if __name__ == '__main__':
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
========= index.html ====================================
<head>
<script src="scripts/test.js"></script>
<link rel="stylesheet" href="styles/main.css" />
</head>
댓글 없음:
댓글 쓰기