-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
36 lines (24 loc) · 951 Bytes
/
server.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
32
33
34
35
36
# -*- coding: utf-8 -*-
import tornado.ioloop
import tornado.options
import tornado.httpserver
from application import application
from tornado.options import define,options
define('port',default=8000,help='run on the given port',type = int)
def main():
tornado.options.parse_command_line()
# 增加日志
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(options.port)
print ("Development server is running at http://127.0.0.1:%s" % options.port)
print ("Quit the server with Control-C")
tornado.ioloop.IOLoop.instance().start()
# http_server.bind(options.port)
# http_server.start(num_processes=0) # tornado将按照cpu核数来fork进程
# tornado.ioloop.IOLoop.instance().start()
if __name__ == '__main__':
main()
# @Time : 2018/3/10 14:42
# @Auth : DAQIUYIN
# @File : server.py.py
# @SoftWare: PyCharm Community Edition