#32173: Autoreloader doesn't work with asyncio.
--------------------------------+------------------------------------
Reporter: Carlton Gibson | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 3.1
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Comment (by Carlton Gibson):
Part of the issue here is the structure of the auto-reloading: as it is
currently,
[https://github.com/django/django/blob/18c5ba07cc81be993941ecc2ecc17923b401b66f/django/utils/autoreload.py#L270-L276
`runserver` is restarted in a subprocess] but then runs Django, in
[https://github.com/django/django/blob/18c5ba07cc81be993941ecc2ecc17923b401b66f/django/utils/autoreload.py#L649-L661
`start_django()` in a thread], watching for changes in the main thread.
(The multiple threads is what causes the issue here, with event loops
being accessed on the wrong thread.)
A different structure would be start Django as a subprocess from the
parent process, watch for changes in that same parent process, and restart
the child process on a change. That's quite a big restructuring (but I
think it might remove the need for the
[https://github.com/django/django/blob/18c5ba07cc81be993941ecc2ecc17923b401b66f/django/utils/autoreload.py#L331
apps `ready_event`] 🤔).
--
Ticket URL: <https://code.djangoproject.com/ticket/32173#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070181cd9cee00-c0b77258-2879-419d-ac4b-2a1df93a3824-000000%40eu-central-1.amazonses.com.