def handle_default_options(self, argv): acc = [] broker = None for i, arg in enumerate(argv): # --settings and --pythonpath are also handled # by BaseCommand.handle_default_options, but that is # called with the resulting options parsed by optparse. if '--settings=' in arg: _, settings_module = arg.split('=') setenv('DJANGO_SETTINGS_MODULE', settings_module) elif '--pythonpath=' in arg: _, pythonpath = arg.split('=') sys.path.insert(0, pythonpath) elif '--broker=' in arg: _, broker = arg.split('=') elif arg == '-b': broker = argv[i + 1] else: acc.append(arg) if broker: self.set_broker(broker) return argv if self.keep_base_opts else acc
def set_broker(self, broker): setenv('CELERY_BROKER_URL', broker)
def main(argv=sys.argv): from django.core import management setenv('CELERY_LOADER', 'default') configure() management.call_command('migrate') run_monitor(argv)
def set_broker(self, broker): setenv("CELERY_BROKER_URL", broker)
def main(argv=sys.argv): from django.core import management setenv('CELERY_LOADER', 'default') configure() management.call_command('syncdb') run_monitor(argv)