设为首页 加入收藏

TOP

Tornado基础学习篇<一>(四)
2018-12-06 16:09:36 】 浏览:340
Tags:Tornado 基础 学习 < >
er(RequestHandler):
def get(self): self.write("<form method='post'><input type='submit' value='登录'></form> ") def post(self): self.redirect('/') # 入口文件 if __name__ == '__main__': tornado.options.parse_command_line() app = tornado.web.Application([(r"/", IndexHandler), (r"/login", LoginHandler), ], debug=True) http_server = tornado.httpserver.HTTPServer(app) http_server.listen(options.port) tornado.ioloop.IOLoop.current().start()

不知道有小伙伴注意到了没,关于debug=True,调试模式,为什么修改代码后不会自动重启。

没找到原因(知道原因的小伙伴评论区解释一下),不过找到了另一个方法,import tornado.autoreload,导入模块就可以自动重启了,有兴趣的小伙伴可以取看看源码。这里就不解释了。

 

本文部分参考tornado中文文档 http://demo.pythoner.com/itt2zh/ch1.html。

本章节到这里就结束了,谢谢大家阅读,感兴趣的话加个关注,后续还会继续更新。

首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇爬虫之股票定向爬取 下一篇Titanic生存分析

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目