* status: new => closed
* resolution: => invalid
Comment:
It already works properly, you just need to set the `DJANGO_COLORS`
environment variable to reach `ServerFormatter`, see
[https://docs.djangoproject.com/en/3.1/ref/django-admin/#syntax-coloring
docs].
--
Ticket URL: <https://code.djangoproject.com/ticket/31924#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Zach Waggoner):
Replying to [comment:1 felixxm]:
> It already works properly, you just need to set the `DJANGO_COLORS`
environment variable to reach `ServerFormatter`, see
[https://docs.djangoproject.com/en/3.1/ref/django-admin/#syntax-coloring
docs].
I might be missing something, but that doesn't work for me. As an example,
trying to run this Procfile through honcho does not preserve the color
output:
{{{
web: DJANGO_COLORS=dark python server/manage.py runserver
}}}
and neither does:
{{{
web: DJANGO_COLORS=dark python server/manage.py runserver --force-color
}}}
This is on Django 3.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/31924#comment:2>
Comment (by felixxm):
It looks that Django doesn't recognize that your system's terminal
supports color, we have an open ticket to improve detection on Windows,
see #31216. You may also fake the installation of `ANSICON` by setting the
appropriate environmental variable, `ANSICON="on"`. Please use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels].
--
Ticket URL: <https://code.djangoproject.com/ticket/31924#comment:3>
Old description:
> Currently, the `--force-color` option doesn't work for the `runserver`
> management command. In my own experimentation, I was able to force color
> output by changing `self.style = color_style()` to `self.style =
> color_style(force_color=True)` in django.utils.log.ServerFormatter. I can
> of course achieve this by using my own django.server formatter class, but
> it would be convenient to have it built in.
New description:
Currently, the `--force-color` option doesn't work for the `runserver`
management command. In my own experimentation, I was able to force color
output by changing `self.style = color_style()` to `self.style =
color_style(force_color=True)` in `django.utils.log.ServerFormatter`. I
can of course achieve this by using my own django.server formatter class,
but it would be convenient to have it built in.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31924#comment:5>