You can download this code by clicking the button below.
This code is now available for download.
This code defines a simple Tornado web server that listens on port 8888. When a GET request is made to the root path, it will return 'Hello, world'.
Technology Stack : Tornado
Code Type : Web Server
Code Difficulty : Intermediate
import tornado.ioloop
import tornado.web
def random_tornado_function():
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()