-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.py
More file actions
34 lines (28 loc) · 905 Bytes
/
Copy pathindex.py
File metadata and controls
34 lines (28 loc) · 905 Bytes
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
#coding:utf-8
'''
启动模块,无需改动,除非增加数据库支持等
'''
import logging
import tornado.log
import tornado.ioloop
import tornado.options
from handler import ApiServer
from config import PORT
from tornado.web import Application
SETTINGS = {
'autoreload':True,
}
class LogFormatter(tornado.log.LogFormatter):
def __init__(self):
super(LogFormatter, self).__init__(
fmt='%(color)s[%(asctime)s %(filename)s:%(funcName)s:%(lineno)d %(levelname)s]%(end_color)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
def main():
tornado.options.parse_command_line()
app = Application(ApiServer.urls,**SETTINGS)
[i.setFormatter(LogFormatter()) for i in logging.getLogger().handlers]
app.listen(PORT,xheaders=True)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()