bgneal@508: """ bgneal@508: This module provides a common way for the various apps to integrate with services bgneal@508: that are installed at this site. bgneal@508: bgneal@508: """ bgneal@508: from django.conf import settings bgneal@508: import redis bgneal@508: bgneal@508: # Redis connection and database settings bgneal@508: bgneal@508: REDIS_HOST = getattr(settings, 'REDIS_HOST', 'localhost') bgneal@508: REDIS_PORT = getattr(settings, 'REDIS_PORT', 6379) bgneal@508: REDIS_DB = getattr(settings, 'REDIS_DB', 0) bgneal@508: bgneal@508: bgneal@508: def get_redis_connection(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB): bgneal@508: """ bgneal@508: Create and return a Redis connection using the supplied parameters. bgneal@508: bgneal@508: """ bgneal@508: return redis.Redis(host=host, port=port, db=db)