在聊天信使中连接到 Redis 服务器时出错



我用Python开发了一个聊天系统。 库被使用:Easygui,Pycrypto,Netifaces,stepic,redis,Rabbitmq,pika,PIL和setuptools。所有库似乎都安装得很好,请参阅: python> 导入库通过使用本地主机上的Redis-Server,用户可以连接到Redis并进行注册,登录,聊天,..但是,当在不同的设备上设置 Redis 并在代码中将本地主机更改为 Redis 服务器 IP 时,我收到以下错误。(我在 Oracle 虚拟机中使用 Lubuntu 最新版本)

enter code here
Traceback (most recent call last):
File "kiducb.py", line 392, in <module>
g = Gui()
File "kiducb.py", line 19, in __init__
self.welcome()
File "kiducb.py", line 33, in welcome
rl = self.login()
File "kiducb.py", line 126, in login
resp = self.check_up(fvals[0], fvals[1], mac)
File "kiducb.py", line 76, in check_up
val = self.re.get(username)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 423, in get
return self.execute_command('GET', name)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 283, in execute_command
connection.send_command(*args)
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 260, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 243, in 
send_packed_command        
self.connect()
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 191, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting 10.1.1.12:6379. Connection refused.

为了解决这个问题,我删除了之前使用 apt-get 从系统安装的 redis-server,并删除了以下链接指令:https://www.digitalocean.com/community/articles/how-to-install-and-use-redis

最新更新