-
Notifications
You must be signed in to change notification settings - Fork 0
/
test3.py
31 lines (23 loc) · 868 Bytes
/
test3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
# @Time : 2020/7/26 22:07
# @Author : Bruce
# @Email : daishaobing@outlook.com
# @File : test3.py
# @Software: PyCharm
from tornado.web import RequestHandler, Application
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
import tornado.options
# 定义变量
tornado.options.define('port', default=8000, type=int, help='this is the port')
class IndexHandler(RequestHandler):
def get(self):
self.write('这是第三个tornado测试,测试端口参数设置')
if __name__ == '__main__':
app = Application([(r'/', IndexHandler)])
tornado.options.parse_command_line()
# tornado.options.parse_config_file('./config') # 从本地读取配置
http_server = HTTPServer(app)
http_server.bind(tornado.options.options.port)
http_server.start(1)
IOLoop.current().start()