Skip to content

Instantly share code, notes, and snippets.

@amalgjose
Last active Aug 29, 2015
Embed
What would you like to do?
Simple python tornado application
__author__ = 'Amal G Jose'
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8888, help="run on the user defined port", type=int)
class HelloWorldHandler(tornado.web.RequestHandler):
def get(self):
print "Someone called me"
self.write("Welcome to Tornado..!!")
if __name__ == "__main__":
app = tornado.web.Application(handlers=[(r"/", HelloWorldHandler)])
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
print "Starting server"
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment