redis.exceptions.ConnectionError: Error -2 connecting to localhost:6379. Name or service not known
It seems that you are trying connect redis with server that is unidentified by your current Debian environment. From Traceback, I see you are trying to connect using host name as localhost ,
r_server=redis.Redis(host="localhost",port=6379)
But , your system is unable to understand "localhost" , make entry in hosts file i.e saying 127.0.0.1 is localhost. add below code in /etc/hosts
127.0.0.1 localhost
otherwise connect redis using below command ;
r_server=redis.Redis(host="127.0.0.1",port=6379)