mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
Add --alias option to runworker
This commit is contained in:
parent
053850fdd6
commit
1ee7b2861c
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue
Block a user