{{{
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).
--
Ticket URL: <https://code.djangoproject.com/ticket/23107>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 1
* needs_docs: => 0
Comment:
Attached a patch to fix the behaviour.
I'll try to write tests and send PR (after Accepted).
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:1>
* owner: nobody => hirokiky
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:2>
Comment (by areski):
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:3>
* cc: areski@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:4>
* cc: timo (added)
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:5>
* status: assigned => new
* cc: hirokiky@… (added)
* owner: hirokiky =>
Comment:
@areski Thanks for your patch. Your solution is direct and seems good. I
deassign from this patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:6>
* owner: => areski
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:7>
Comment (by areski):
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
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"67d7da5fb9498b811f0168f5df2308ad4743027f"]:
{{{
#!CommitTicketReference repository=""
revision="67d7da5fb9498b811f0168f5df2308ad4743027f"
Fixed #23107 -- Made runserver output respect --no-color.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"7cb4a82eaf2c6b59a80699ae91b63180eb8a47ef"]:
{{{
#!CommitTicketReference repository=""
revision="7cb4a82eaf2c6b59a80699ae91b63180eb8a47ef"
[1.7.x] Fixed #23107 -- Made runserver output respect --no-color.
Backport of 67d7da5fb9 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:10>
Comment (by hirokiky):
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
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:11>
Comment (by timo):
Sorry, I forgot to add that.
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:12>
Comment (by loic):
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:13>
Comment (by loic):
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:14>
Comment (by Loic Bistuer <loic.bistuer@…>):
In [changeset:"c34e13e17c664ea43b85572428bcf74c7509db3f"]:
{{{
#!CommitTicketReference repository=""
revision="c34e13e17c664ea43b85572428bcf74c7509db3f"
Fixed #23107 -- Made runserver output respect --no-color.
This commit reverts 67d7da5fb9498b811f0168f5df2308ad4743027f.
The previous fix changed the environment globally, which meant
that any call to `call_command(no_color=True)` prevented further
`call_command` with color.
This fix still relies on the environment because it's currently the only
way to reach WSGIRequestHandler, but it's now limited to the `runserver`
command. This seems an acceptable compromise considering `runserver` runs
indefinitely.
Thanks Tim Graham for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:15>