-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapplication.py
More file actions
31 lines (23 loc) · 773 Bytes
/
application.py
File metadata and controls
31 lines (23 loc) · 773 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
# -*- coding:utf-8 -*-
from tornado import web
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
from library.Urls import route
from controllers.Error import NotFoundHandler
from conf import conf
class Application(web.Application):
def __init__(self):
settings = dict(
debug=conf.debug,
autoreload=conf.debug,
default_handler_class=NotFoundHandler,
compress_response=False
)
super(Application, self).__init__(route.get_urls(), **settings)
def main():
print("http server start, Ctrl + C to stop...")
http_server = HTTPServer(Application(), xheaders=True)
http_server.listen(conf.port)
IOLoop.current().start()
if __name__ == '__main__':
main()