Created
August 5, 2015 08:29
-
-
Save shrkw/d44f9ee7d7ecc9b0b90c to your computer and use it in GitHub Desktop.
tornado app on gunicorn
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
# 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