--
Ticket URL: <https://code.djangoproject.com/ticket/31793>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by James Pic):
Patch: https://github.com/django/django/pull/13190
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:1>
* status: new => closed
* resolution: => wontfix
Comment:
Hi James.
Thanks for the suggestion. I'm going to say wontfix here: there's no need
for ''async management commands''. If a management command needs to run
async code, for which, of course, there may be a need, `asyncio.run()` is
the perfect approach. (I see you note that as the workaround on the PR.)
It's just not worth any complexity to be able to handle top level async
def handle methods directly. '
I hope that makes sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:2>
Comment (by James Pic):
Well I'm not to judge if it makes sense, time & users will tell ;)
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:3>
Comment (by James Pic):
Just for the update: it seems both async and non async middlewares will be
supported by Django: https://forum.djangoproject.com/t/the-trouble-with-
middleware/19/11
So, if management commands would support both then it wouldn't be
inconsistent.
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:4>
Comment (by Carlton Gibson):
Hi James. There's a fundamental difference between middlewares, which sit
squarely on the request-response pathway, and **need** to be async capable
if we're to leverage the full potential of that, on the one hand, and
management commands, which are called one-by-one from the command line
most usually, on the other. A management can **use** async code, in which
can `asyncio.run()` is fine, but there's no demonstrated need for the top-
level `handle()` entry point to itself be async capable. There's no
concurrency need for management commands. ("Au contraire mon ami" -- fine,
use multiprocessing if you insist, but there's nothing that's worth adding
complexity to the main entry point here for.)
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:5>
* cc: Jon Janzen (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:6>