Created
April 17, 2012 01:40
-
-
Save makotoworld/2402821 to your computer and use it in GitHub Desktop.
flask deploy tornado
This file contains 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
#!/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() |
This file contains 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
#!/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