Skip to content

Instantly share code, notes, and snippets.

@Kroisse
Last active December 15, 2015 13:39
Show Gist options
  • Select an option

  • Save Kroisse/5269272 to your computer and use it in GitHub Desktop.

Select an option

Save Kroisse/5269272 to your computer and use it in GitHub Desktop.
import eventlet
eventlet.monkey_patch()
import time
import flask
def a(i):
# shsh~~!
return '<p>{0}</p>'.format(i)
@flask.stream_with_context
def process():
for i in xrange(100):
yield a(i)
time.sleep(1)
app = flask.Flask(__name__)
@app.route('/')
def home():
return flask.Response(process())
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment