From 64fe0cb77f29095e9b6d04bfb2013146a8d8ac14 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 20 Feb 2016 22:56:10 +0000 Subject: [PATCH] Add --noasgi option to runserver to run the old WSGI server instead --- channels/management/commands/runserver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/channels/management/commands/runserver.py b/channels/management/commands/runserver.py index 74a7ca1..feb2436 100644 --- a/channels/management/commands/runserver.py +++ b/channels/management/commands/runserver.py @@ -19,6 +19,8 @@ class Command(RunserverCommand): super(Command, self).add_arguments(parser) parser.add_argument('--noworker', action='store_false', dest='run_worker', default=True, help='Tells Django not to run a worker thread; you\'ll need to run one separately.') + parser.add_argument('--noasgi', action='store_false', dest='use_asgi', default=True, + help='Run the old WSGI-based runserver rather than the ASGI-based one') def handle(self, *args, **options): self.verbosity = options.get("verbosity", 1) @@ -26,6 +28,9 @@ class Command(RunserverCommand): super(Command, self).handle(*args, **options) def inner_run(self, *args, **options): + # Maybe they want the wsgi one? + if not options.get("use_asgi", True): + return RunserverCommand.inner_run(self, *args, **options) # Check a handler is registered for http reqs; if not, add default one self.channel_layer = channel_layers[DEFAULT_CHANNEL_LAYER] self.channel_layer.registry.check_default()