Example #1
0
 def __init__(self, *args, **kwargs):
     super(RedisPubSubBackend, self).__init__(*args, **kwargs)
     backend_settings = get_setting('DJANGO_GEVENT_PUBSUB')
     if not 'host' in backend_settings:
         raise ImproperlyConfigured("DJANGO_GEVENT_PUBSUB['host'] not set, required to the django_gevent PubSubQueue to function.")
     if not 'port' in backend_settings:
         raise ImproperlyConfigured("DJANGO_GEVENT_PUBSUB['port'] not set, required to the django_gevent PubSubQueue to function.")
     if not 'db' in backend_settings:
         raise ImproperlyConfigured("DJANGO_GEVENT_PUBSUB['db'] not set, required to the django_gevent PubSubQueue to function.")
     self.rcon = redis.Redis(host=backend_settings['host'], port=backend_settings['port'], db=backend_settings['db'])
Example #2
0
def load_backend():
    backend_settings = get_setting('DJANGO_GEVENT_PUBSUB')
    if 'backend' in backend_settings:
        backend_path = backend_settings['backend']
    else:
        raise ImproperlyConfigured("DJANGO_GEVENT_PUBSUB['backend'] not set, required to the django_gevent PubSubQueue to function.")
        
    backend_module_name = '.'.join(backend_path.split('.')[:-1])
    backend_class_name = backend_path.split('.')[-1]
    backend_class = getattr(import_module(backend_module_name), backend_class_name)
    return backend_class