def init_app(self, app):
        """
        Initialize the app, e.g. can be used if factory pattern is used.
        """
        # The connection related config values
        self.redis_url = app.config.setdefault(
            'RQ_REDIS_URL',
            self.redis_url,
        )
        self.connection_class = app.config.setdefault(
            'RQ_CONNECTION_CLASS',
            self.connection_class,
        )
        # all infos to create a Redis connection are now avaiable.
        self._ready_to_connect = True

        self.queues = app.config.setdefault(
            'RQ_QUEUES',
            self.queues,
        )
        self.queue_class = app.config.setdefault(
            'RQ_QUEUE_CLASS',
            self.queue_class,
        )
        self.worker_class = app.config.setdefault(
            'RQ_WORKER_CLASS',
            self.worker_class,
        )
        self.job_class = app.config.setdefault(
            'RQ_JOB_CLASS',
            self.job_class,
        )
        self.scheduler_class = app.config.setdefault(
            'RQ_SCHEDULER_CLASS',
            self.scheduler_class,
        )
        self.scheduler_queue = app.config.setdefault(
            'RQ_SCHEDULER_QUEUE',
            self.scheduler_queue,
        )
        self.scheduler_interval = app.config.setdefault(
            'RQ_SCHEDULER_INTERVAL',
            self.scheduler_interval,
        )

        #: Whether or not to run RQ jobs asynchronously or not,
        #: defaults to asynchronous
        _async = app.config.setdefault('RQ_ASYNC', True)
        if self._is_async is None:
            self._is_async = _async

        # register extension with app
        app.extensions = getattr(app, 'extensions', {})
        app.extensions['rq2'] = self

        if hasattr(app, 'cli'):
            self.init_cli(app)
def init_app ( self , app ) : self . redis_url = app . config . setdefault ( 'RQ_REDIS_URL' , self . redis_url , ) self . connection_class = app . config . setdefault ( 'RQ_CONNECTION_CLASS' , self . connection_class , ) self . _ready_to_connect = True self . queues = app . config . setdefault ( 'RQ_QUEUES' , self . queues , ) self . queue_class = app . config . setdefault ( 'RQ_QUEUE_CLASS' , self . queue_class , ) self . worker_class = app . config . setdefault ( 'RQ_WORKER_CLASS' , self . worker_class , ) self . job_class = app . config . setdefault ( 'RQ_JOB_CLASS' , self . job_class , ) self . scheduler_class = app . config . setdefault ( 'RQ_SCHEDULER_CLASS' , self . scheduler_class , ) self . scheduler_queue = app . config . setdefault ( 'RQ_SCHEDULER_QUEUE' , self . scheduler_queue , ) self . scheduler_interval = app . config . setdefault ( 'RQ_SCHEDULER_INTERVAL' , self . scheduler_interval , ) _async = app . config . setdefault ( 'RQ_ASYNC' , True ) if self . _is_async is None : self . _is_async = _async app . extensions = getattr ( app , 'extensions' , { } ) app . extensions [ 'rq2' ] = self if hasattr ( app , 'cli' ) : self . init_cli ( app )
Initialize the app, e.g. can be used if factory pattern is used.