Commit bc1f4997 by Sheng

Added debug option

parent 7474fb76
...@@ -16,6 +16,7 @@ from tornado.util import errno_from_exception ...@@ -16,6 +16,7 @@ from tornado.util import errno_from_exception
define('address', default='127.0.0.1', help='listen address') define('address', default='127.0.0.1', help='listen address')
define('port', default=8888, help='listen port', type=int) define('port', default=8888, help='listen port', type=int)
define('debug', default=False, help='debug mode', type=bool)
BUF_SIZE = 1024 BUF_SIZE = 1024
...@@ -264,8 +265,7 @@ def main(): ...@@ -264,8 +265,7 @@ def main():
'template_path': os.path.join(base_dir, 'templates'), 'template_path': os.path.join(base_dir, 'templates'),
'static_path': os.path.join(base_dir, 'static'), 'static_path': os.path.join(base_dir, 'static'),
'cookie_secret': uuid.uuid1().hex, 'cookie_secret': uuid.uuid1().hex,
'xsrf_cookies': True, 'xsrf_cookies': True
'debug': True
} }
handlers = [ handlers = [
...@@ -274,6 +274,7 @@ def main(): ...@@ -274,6 +274,7 @@ def main():
] ]
parse_command_line() parse_command_line()
settings.update(debug=options.debug)
app = tornado.web.Application(handlers, **settings) app = tornado.web.Application(handlers, **settings)
app.listen(options.port, options.address) app.listen(options.port, options.address)
logging.info('Listening on {}:{}'.format(options.address, options.port)) logging.info('Listening on {}:{}'.format(options.address, options.port))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment