mirror of
https://github.com/django/daphne.git
synced 2025-07-14 09:52:17 +03:00
Add --noasgi option to runserver to run the old WSGI server instead
This commit is contained in:
parent
267e56ce2a
commit
64fe0cb77f
|
@ -19,6 +19,8 @@ class Command(RunserverCommand):
|
||||||
super(Command, self).add_arguments(parser)
|
super(Command, self).add_arguments(parser)
|
||||||
parser.add_argument('--noworker', action='store_false', dest='run_worker', default=True,
|
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.')
|
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):
|
def handle(self, *args, **options):
|
||||||
self.verbosity = options.get("verbosity", 1)
|
self.verbosity = options.get("verbosity", 1)
|
||||||
|
@ -26,6 +28,9 @@ class Command(RunserverCommand):
|
||||||
super(Command, self).handle(*args, **options)
|
super(Command, self).handle(*args, **options)
|
||||||
|
|
||||||
def inner_run(self, *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
|
# Check a handler is registered for http reqs; if not, add default one
|
||||||
self.channel_layer = channel_layers[DEFAULT_CHANNEL_LAYER]
|
self.channel_layer = channel_layers[DEFAULT_CHANNEL_LAYER]
|
||||||
self.channel_layer.registry.check_default()
|
self.channel_layer.registry.check_default()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user