def configure_redis():
"""
Creates a connection to the local Redis server, then returns the active
connection.
:return: object: the active Redis object.
"""
try:
url = os.getenv('REDIS_CONNECTION_URL', 'redis://localhost:6379/0')
redis_server = redis.StrictRedis.from_url(url)
redis_server.ping()
except redis.exceptions.ConnectionError:
logging.fatal("Redis server is not running! Exiting!")
sys.exit(1)
return redis_server
评论列表
文章目录