Created
December 9, 2019 03:35
-
-
Save browny/89d5ea4aaf4d4c148888ea40881002c5 to your computer and use it in GitHub Desktop.
web-server.py
This file contains hidden or 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 | |
import socket | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hostname: " + socket.gethostname()) | |
def make_app(): | |
return tornado.web.Application([ | |
(r"/", MainHandler), | |
]) | |
if __name__ == "__main__": | |
app = make_app() | |
app.listen(8888) | |
tornado.ioloop.IOLoop.current().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment