-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserve.py
32 lines (28 loc) · 858 Bytes
/
serve.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
"""
simple python chat server
"""
import tornado.escape
import tornado.ioloop
import tornado.web
import os.path
from tornado.options import define, options, parse_command_line
from handlers.routes import route
define("port", default=8888, help="run on the given port", type=int)
define("debug", default=False, help="run in debug mode")
def main():
"""
main application entry point
"""
parse_command_line()
app = tornado.web.Application(
route,
cookie_secret="adnadfhaihjngjwgegegjsofsknfmadajdn",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
xsrf_cookies=False,
debug=options.debug,
)
app.listen(options.port)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()