initialize.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:tor_core 作者: GrafeasGroup 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号