diff --git a/channels/management/commands/runworker.py b/channels/management/commands/runworker.py index e5fa5ff..43af56a 100644 --- a/channels/management/commands/runworker.py +++ b/channels/management/commands/runworker.py @@ -8,11 +8,16 @@ from channels.worker import Worker class Command(BaseCommand): + def add_arguments(self, parser): + super(Command, self).add_arguments(parser) + parser.add_argument('--alias', action='store', dest='alias', default=DEFAULT_CHANNEL_LAYER, + help='Channel layer alias to use, if not the default.') + def handle(self, *args, **options): # Get the backend to use self.verbosity = options.get("verbosity", 1) self.logger = setup_logger('django.channels', self.verbosity) - self.channel_layer = channel_layers[DEFAULT_CHANNEL_LAYER] + self.channel_layer = channel_layers[options.get("alias", DEFAULT_CHANNEL_LAYER)] # Check that handler isn't inmemory if self.channel_layer.local_only(): raise CommandError(