Skip to content

Instantly share code, notes, and snippets.

@shrkw
Created August 5, 2015 08:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shrkw/d44f9ee7d7ecc9b0b90c to your computer and use it in GitHub Desktop.
Save shrkw/d44f9ee7d7ecc9b0b90c to your computer and use it in GitHub Desktop.
tornado app on gunicorn
# https://github.com/benoitc/gunicorn/blob/master/examples/frameworks/tornadoapp.py
# gunicorn -k tornado tor:app
import tornado.ioloop
import tornado.web
import tornado.options
tornado.options.define('port', type=int, default='8080', help=u'port number')
class MainHandler(tornado.web.RequestHandler):
def get(self):
print("get")
self.write("Hello, world")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
def main():
app = make_app()
return app
app = main()
if __name__ == "__main__":
print("starting..........")
app.listen(8008)
tornado.ioloop.IOLoop.current().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment