How to use aioredis in tornado

625 views
Skip to first unread message

michael tsui

unread,
Oct 25, 2016, 9:42:19 PM10/25/16
to aio-libs
Hello, Every one. I want to add a redis client to my Tornado Application by using aioredis.And I write the following code:


When I press the ctrl-c to stop the server, I will get following warnings:

sys:1: RuntimeWarning: coroutine 'redis_connect' was never awaited

So, can anyone tell me how to add a redis client for tornado app correctly?
Message has been deleted

michael tsui

unread,
Oct 25, 2016, 10:12:09 PM10/25/16
to aio-libs
I find two examples on github.



And I think i should init the redis client in another class, and pass the client to the tornado app.

a.pop...@smartweb.com.ua

unread,
Oct 26, 2016, 3:47:44 AM10/26/16
to aio-libs
Hi, please take a look at this example on how to "await" redis client initialization (and any other async stuff)

https://github.com/rudyryk/python-samples/blob/master/hello_tornado/hello_asyncio.py#L85-L99

среда, 26 октября 2016 г., 5:12:09 UTC+3 пользователь michael tsui написал:
Reply all
Reply to author
Forward
0 new messages