[Django] #36434: manage.py runserver only respects python -u flag if --noreload is present (-u flag forces streams to be unbuffered)

15 views
Skip to first unread message

Django

unread,
Jun 3, 2025, 4:05:18 PMJun 3
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivanca | Type: Bug
Status: new | Component:
| Uncategorized
Version: 5.1 | Severity: Normal
Keywords: runserver, -u, | Triage Stage:
PYTHONUNBUFFERED | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
From python help:

{{{
-u : force the stdout and stderr streams to be unbuffered;
this option has no effect on stdin; also PYTHONUNBUFFERED=x

}}}

Running **manage.py runserver** only respects python -u flag if --noreload
is present, meanwhile setting the environment variable PYTHONUNBUFFERED=1
works fine.

The solution is likely to make sure subprocesses to be called with the
very same flag.
--
Ticket URL: <https://code.djangoproject.com/ticket/36434>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 3, 2025, 4:06:46 PMJun 3
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivanca | Owner: (none)
Type: Bug | Status: new
Component: Uncategorized | Version: 5.1
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage:
PYTHONUNBUFFERED | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Ivanca:

Old description:

> From python help:
>
> {{{
> -u : force the stdout and stderr streams to be unbuffered;
> this option has no effect on stdin; also PYTHONUNBUFFERED=x
>
> }}}
>
> Running **manage.py runserver** only respects python -u flag if
> --noreload is present, meanwhile setting the environment variable
> PYTHONUNBUFFERED=1 works fine.
>
> The solution is likely to make sure subprocesses to be called with the
> very same flag.

New description:

From python help:

{{{
-u : force the stdout and stderr streams to be unbuffered;
this option has no effect on stdin; also PYTHONUNBUFFERED=x

}}}

Running **manage.py runserver** only respects python -u flag if --noreload
is present, meanwhile setting the environment variable PYTHONUNBUFFERED=1
works fine.

The solution is likely to make sure subprocesses are called with the very
same flag.

--
--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:1>

Django

unread,
Jun 3, 2025, 4:07:43 PMJun 3
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivanca | Owner: (none)
Type: Bug | Status: new
Component: Core (Management | Version: 5.1
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage:
PYTHONUNBUFFERED | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ivanca):

* component: Uncategorized => Core (Management commands)

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:2>

Django

unread,
Jun 4, 2025, 6:44:21 AMJun 4
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner: (none)
Type: Bug | Status: new
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted
* version: 5.1 => dev

Comment:

Thank you, replicated
--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:3>

Django

unread,
Jun 8, 2025, 4:16:51 AMJun 8
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| myoungjinGo
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by myoungjinGo):

* owner: (none) => myoungjinGo
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:4>

Django

unread,
Aug 31, 2025, 3:32:25 AMAug 31
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner: (none)
Type: Bug | Status: new
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by myoungjinGo):

* owner: myoungjinGo => (none)
* status: assigned => new

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:5>

Django

unread,
Aug 31, 2025, 5:49:45 AMAug 31
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by JaeHyuckSa):

* owner: (none) => JaeHyuckSa
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:6>

Django

unread,
Aug 31, 2025, 5:57:17 AMAug 31
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by JaeHyuckSa):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:7>

Django

unread,
Sep 23, 2025, 8:05:13 AM (6 days ago) Sep 23
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:8>

Django

unread,
Sep 23, 2025, 11:32:10 AM (6 days ago) Sep 23
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Accepted
PYTHONUNBUFFERED |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by JaeHyuckSa):

* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:9>

Django

unread,
Sep 24, 2025, 9:32:44 AM (5 days ago) Sep 24
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: runserver, -u, | Triage Stage: Ready for
PYTHONUNBUFFERED | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:10>

Django

unread,
Sep 25, 2025, 5:38:39 AM (4 days ago) Sep 25
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: runserver, -u, | Triage Stage: Ready for
PYTHONUNBUFFERED | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"68aae8878ff90dd787db55ecc44ee712525ccdc6" 68aae887]:
{{{#!CommitTicketReference repository=""
revision="68aae8878ff90dd787db55ecc44ee712525ccdc6"
Fixed #36434 -- Preserved unbuffered stdio (-u) in autoreloader child.

Signed-off-by: SaJH <wogur...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:11>

Django

unread,
Sep 25, 2025, 5:40:50 AM (4 days ago) Sep 25
to django-...@googlegroups.com
#36434: manage.py runserver only respects python -u flag if --noreload is present
(-u flag forces streams to be unbuffered)
-------------------------------------+-------------------------------------
Reporter: Ivan | Owner:
| JaeHyuckSa
Type: Bug | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: runserver, -u, | Triage Stage: Ready for
PYTHONUNBUFFERED | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"db2f206ee1b1be68e77ffc26eccdcd662897df65" db2f206e]:
{{{#!CommitTicketReference repository=""
revision="db2f206ee1b1be68e77ffc26eccdcd662897df65"
[6.0.x] Fixed #36434 -- Preserved unbuffered stdio (-u) in autoreloader
child.

Signed-off-by: SaJH <wogur...@gmail.com>

Backport of 68aae8878ff90dd787db55ecc44ee712525ccdc6 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36434#comment:12>
Reply all
Reply to author
Forward
0 new messages