Skip to content

Instantly share code, notes, and snippets.

@makotoworld
Created April 17, 2012 01:40
Show Gist options
  • Save makotoworld/2402821 to your computer and use it in GitHub Desktop.
Save makotoworld/2402821 to your computer and use it in GitHub Desktop.
flask deploy tornado
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
from tornado.web import FallbackHandler, RequestHandler, Application
from wsgi import app
class MainHandler(RequestHandler):
def get(self):
self.write("This message comes from Tornado ^_^")
tr = WSGIContainer(app)
application = Application([
(r"/tornado", MainHandler),
(r".*", FallbackHandler, dict(fallback=tr)),
])
if __name__ == "__main__":
application.listen(8000)
IOLoop.instance().start()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)
@app.route('/flask')
def hello_world():
return 'This comes from Flask ^_^'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment