#23107 closed Bug (fixed)
--no-color option won't work for output of runserver command
| Reported by: | Hiroki Kiyohara | Owned by: | Areski Belaid |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 1.7-rc-1 |
| Severity: | Normal | Keywords: | |
| Cc: | areski@…, Tim Graham, hirokiky@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The --no-color option won't work for output of runserver command.
python manage.py runserver --no-color ... [26/Jul/2014 15:01:07] "GET / HTTP/1.1" 500 85001 # Colored
Ticket for --no-color feature did not include about WSGIServer https://code.djangoproject.com/ticket/19877
And, output of the WSGIServer will be colorized.
(actually output of the management command won't be colorized).
Attachments (1)
Change History (16)
by , 11 years ago
| Attachment: | 23107.diff added |
|---|
comment:1 by , 11 years ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
comment:2 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 11 years ago
I tried the patch to add a review and it didn't worked for me, so I made the following pull request:
https://github.com/django/django/pull/2989
I think this need a more advanced Django dev to review it and maybe put us in the right direction.
comment:4 by , 11 years ago
| Cc: | added |
|---|
comment:5 by , 11 years ago
| Cc: | added |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:6 by , 11 years ago
| Cc: | added |
|---|---|
| Owner: | removed |
| Status: | assigned → new |
@areski Thanks for your patch. Your solution is direct and seems good. I deassign from this patch.
comment:7 by , 11 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:8 by , 11 years ago
I'm taking a much more simplistic approach to solve this, same as mentioned in the original patch but with a correction.
https://github.com/django/django/pull/2998
comment:9 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:11 by , 11 years ago
Thank you guys.
I think it's better to credit @timo and me on the commit log.
https://docs.djangoproject.com/en/1.7/internals/contributing/committing-code/#committing-guidelines
comment:13 by , 11 years ago
I don't think modifying the environment is an appropriate fix, if you use call_command(no_color=True), every other call_command() won't have color. I'm in favor of a revert.
comment:14 by , 11 years ago
Sadly it doesn't seem that we have any other ways than the environment to reach WSGIRequestHandler. In https://github.com/django/django/pull/3391 I limit the change of environment to the runserver command which is IMO acceptable considering this command runs forever.
Attached a patch to fix the behaviour.
I'll try to write tests and send PR (after Accepted).
It seems difficult to write test (Running debug server with --no-color option and checking the log).
So If you have some idea, please share.