docker版本我可以正常运行
然后我按照readme
修改userinfo.json.example为文件userinfo.json,并填好QQ号、QQ密码、保存数据用的文件名前缀;
随后我打开了redis,然后
python3 src/web/server.py
但是:
`36d3b270ee04:python -u /opt/project/src/web/server.py
['/opt/project/src/web', '/opt/project', '/opt/.pycharm_helpers/pycharm_display', '/usr/local/lib/python36.zip', '/usr/local/lib/python3.6', '/usr/local/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-packages', '/opt/.pycharm_helpers/pycharm_matplotlib_backend', '/opt/project', '/opt/project', '/opt/project/src', '/opt/project']
Traceback (most recent call last):
Failed to connect redis: Error -2 connecting to redis:6379. Name or service not known.
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 572, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/project/src/web/web_util/web_util.py", line 59, in judge_pool
conn.set('redis_success', 1)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1072, in set
return self.execute_command('SET', *pieces)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 464, in _connect
socket.SOCK_STREAM):
File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 572, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error -2 connecting to redis:6379. Name or service not known.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 464, in _connect
socket.SOCK_STREAM):
File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/project/src/web/server.py", line 17, in
host = judge_pool()
File "/opt/project/src/web/web_util/web_util.py", line 69, in judge_pool
raise e
File "/opt/project/src/web/web_util/web_util.py", line 65, in judge_pool
conn.set('redis_success', 2)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1072, in set
return self.execute_command('SET', *pieces)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error -2 connecting to redis:6379. Name or service not known.
Process finished with exit code 1
`
看样子是没有成功连接到redis,我对redis没有什么了解,我找不到我哪个地方出了问题
我使用了
redis-server
启动了redis
并且可以成功redis-cli
ping 127.0.0.1:6379
请问我哪一步出了问题,谢谢!