def __init__(self): path = getattr(settings, 'CELERY_APPLICATION_PATH', None) if path is None: raise ValueError( 'You need to define "CELERY_APPLICATION_PATH" on settings.') self._application = import_object(path) self._control = Control(self._application) self._default_queue = self._application.amqp.default_queue.name self._routes = getattr(settings, 'CELERY_ROUTES', {})
def register(blueprint, url_prefix=None): """blueprint structure: {{blueprint}}/ __init__.py models.py views.py """ if url_prefix is None: url_prefix = '/%s' % blueprint views = import_object('%s.views' % blueprint) app.register_blueprint(views.app, url_prefix=url_prefix) return app
def run(*args): task_verbose = args[1] task = import_object(task_verbose) task.delay()