Last active
December 28, 2015 16:08
-
-
Save andreadipersio/7526374 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado.ioloop | |
import tornado.web | |
# http://www.tornadoweb.org/en/stable/options.html | |
from tornado.options import parse_command_line, define, options | |
define("port", default=8888) | |
define("debug", default=False) | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, world") | |
handlers = [ | |
(r"/", MainHandler), | |
] | |
if __name__ == "__main__": | |
parse_command_line() | |
# debug=True will enable tornado debug mode | |
# http://www.tornadoweb.org/en/stable/overview.html#debug-mode | |
application = tornado.web.Application(handlers, debug=options.debug) | |
application.listen(options.port) | |
tornado.ioloop.IOLoop.instance().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment