I have a Bottle application that uses subprocesses to do most of the work for requests. For routes that return a single response, I do something like what\'s below.
After a lot of research and experimenting, I've determined that a gevent queue can't be used with Python multiprocessing in this way. Instead of doing things this way, something like redis can be used to allow the processes and gevent greenlets communicate.
@route('/stream')
def index():
worker = multiprocessing.Process(target=do_stuff)
worker.start()
yield redis_server.lpop()
def do_stuff(body):
while True:
gevent.sleep(5)
redis_server.lpush("data")