Last active
October 19, 2020 22:41
-
-
Save andreadipersio/7528070 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): | |
name = self.get_argument("name", default="world") | |
self.write("Hello, {}!".format(name)) | |
handlers = [ | |
(r"/", MainHandler), | |
] | |
if __name__ == "__main__": | |
parse_command_line() | |
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