/
run.py
30 lines (24 loc) · 850 Bytes
/
run.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
# -*- coding: utf-8 -*-
import argparse
import locale
import tornado.ioloop
import tornado.web
import config
from config import AppConfig
import routes
# date of release; run fab timestamp to set it
__date__ = "2012-03-01 19:02:03+0000"
__version__ = "1"
if __name__ == '__main__':
args_parser = argparse.ArgumentParser()
args_parser.add_argument("-p", "--port", type=int)
clargs = vars(args_parser.parse_args())
port = clargs["port"]
if port is None:
port = 8000
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
application = tornado.web.Application(routes.all,
cookie_secret=AppConfig.default().cookie_secret,
debug=config.is_debug())
application.listen(port, xheaders=True)
tornado.ioloop.IOLoop.instance().start()