我已经在django项目中实现了channel2,启动一段时间后,我在服务器上收到此错误,我在ubuntu上获取了我的代码。
2019-02-12 10:30:51,863 ERROR Exception inside application: [Errno -3] Temporary failure in name resolution
File "/var/www/RPG/python/lib/python3.6/site-packages/channels/consumer.py", line 59, in _call_
[receive, self.channel_receive], self.dispatch
File "/var/www/RPG/python/lib/python3.6/site-packages/channels/utils.py", line 59, in await_many_dispatch
await task
File "/var/www/RPG/python/lib/python3.6/site-packages/channels/utils.py", line 51, in await_many_dispatch
result = task.result()
File "/var/www/RPG/python/lib/python3.6/site-packages/channels_redis/core.py", line 429, in receive
real_channel
File "/var/www/RPG/python/lib/python3.6/site-packages/channels_redis/core.py", line 484, in receive_single
index, channel_key, timeout=self.brpop_timeout
File "/var/www/RPG/python/lib/python3.6/site-packages/channels_redis/core.py", line 324, in _brpop_with_clean
async with self.connection(index) as connection:
File "/var/www/RPG/python/lib/python3.6/site-packages/channels_redis/core.py", line 820, in _aenter_
self.conn = await self.pool.pop()
File "/var/www/RPG/python/lib/python3.6/site-packages/channels_redis/core.py", line 70, in pop
conns.append(await aioredis.create_redis(**self.host, loop=loop))
File "/var/www/RPG/python/lib/python3.6/site-packages/aioredis/commands/__init__.py", line 178, in create_redis
loop=loop)
File "/var/www/RPG/python/lib/python3.6/site-packages/aioredis/connection.py", line 108, in create_connection
timeout, loop=loop)
File "/usr/lib/python3.6/asyncio/tasks.py", line 339, in wait_for
return (yield from fut)
File "/var/www/RPG/python/lib/python3.6/site-packages/aioredis/stream.py", line 19, in open_connection
lambda: protocol, host, port, **kwds)
File "/usr/lib/python3.6/asyncio/base_events.py", line 739, in create_connection
infos = f1.result()
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
[Errno -3] Temporary failure in name resolution
我在这里附上一张可以解决问题的图像,但我需要找到更好的解决方案。我认为这样做不是适当的方法。