annotate gpp/core/services.py @ 564:e5d3552d4ad0
The ajax login didn't work from the register page. I think this is because
there are two input boxes with the same ID in this situation. Renamed the
ajax login form's ID's to make them unique.
author |
Brian Neal <bgneal@gmail.com> |
date |
Mon, 13 Feb 2012 19:34:29 -0600 |
parents |
f72ace06658a |
children |
|
rev |
line source |
bgneal@508
|
1 """
|
bgneal@508
|
2 This module provides a common way for the various apps to integrate with services
|
bgneal@508
|
3 that are installed at this site.
|
bgneal@508
|
4
|
bgneal@508
|
5 """
|
bgneal@508
|
6 from django.conf import settings
|
bgneal@508
|
7 import redis
|
bgneal@508
|
8
|
bgneal@508
|
9 # Redis connection and database settings
|
bgneal@508
|
10
|
bgneal@508
|
11 REDIS_HOST = getattr(settings, 'REDIS_HOST', 'localhost')
|
bgneal@508
|
12 REDIS_PORT = getattr(settings, 'REDIS_PORT', 6379)
|
bgneal@508
|
13 REDIS_DB = getattr(settings, 'REDIS_DB', 0)
|
bgneal@508
|
14
|
bgneal@508
|
15
|
bgneal@508
|
16 def get_redis_connection(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB):
|
bgneal@508
|
17 """
|
bgneal@508
|
18 Create and return a Redis connection using the supplied parameters.
|
bgneal@508
|
19
|
bgneal@508
|
20 """
|
bgneal@519
|
21 return redis.StrictRedis(host=host, port=port, db=db)
|