Redis server now configurable with Q_REDIS. Moved constants to conf

This commit is contained in:
Ilan Steemers
2015-06-27 12:08:33 +02:00
parent 3b7682411c
commit d8020f0c0b
3 changed files with 83 additions and 13 deletions
+28 -1
View File
@@ -1,8 +1,17 @@
from django.conf import settings
from signal import signal
from multiprocessing import cpu_count
from django.conf import settings
VERSION = '0.1.0'
"""
Redis server connection
"""
try:
REDIS = settings.Q_REDIS
except AttributeError:
REDIS = {}
"""
Prefixes the Redis keys. Defaults to django_q
"""
@@ -54,3 +63,21 @@ try:
USE_TZ = settings.USE_TZ
except AttributeError:
USE_TZ = False
"""
Getting the SIGNAL names
"""
SIGNAL_NAMES = dict((getattr(signal, n), n) for n in dir(signal) if n.startswith('SIG') and '_' not in n)
"""
Redis List name
"""
Q_LIST = '{}:q'.format(PREFIX)
"""
Cluster status
"""
STARTING = 'Starting'
RUNNING = 'Running'
STOPPED = 'Stopped'
STOPPING = 'Stopping'