【发布时间】:2015-05-02 11:09:16
【问题描述】:
class AsyncHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
tasks.sleep.apply_async(args=[5], callback=self.on_result)
def on_result(self, response):
self.write(str(response.result))
self.finish()
引发错误:
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <bound method AsyncHandler.on_result
of <__main__.AsyncHandler object at 0x10e7a19d0>> is not JSON serializable
broker 和 backends 都使用 redis,我只是从 https://github.com/mher/tornado-celery
当我使用 amqp 代理和 redis 后端时,它运行良好,但在使用 redis 代理时却不行。这是因为 tornado async 不支持 redis 代理吗?
【问题讨论】:
-
当我使用 amqp 代理和 redis 后端时它运行良好,因为 tornado async 不支持 redis borker?
标签: python json redis celery tornado