Mercurial > public > sg101
view core/services.py @ 697:67f8d49a9377
Cleaned up the code a bit.
Separated the S3 stuff out into its own class.
This class maybe should be in core.
Still want to do some kind of context manager around the temporary file we are
creating to ensure it gets deleted.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 08 Sep 2013 21:02:58 -0500 |
parents | ee87ea74d46b |
children | a423e8fd082d |
line wrap: on
line source
""" This module provides a common way for the various apps to integrate with services that are installed at this site. """ from django.conf import settings import redis # Redis connection and database settings REDIS_HOST = getattr(settings, 'REDIS_HOST', 'localhost') REDIS_PORT = getattr(settings, 'REDIS_PORT', 6379) REDIS_DB = getattr(settings, 'REDIS_DB', 0) def get_redis_connection(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB): """ Create and return a Redis connection using the supplied parameters. """ return redis.StrictRedis(host=host, port=port, db=db)