#31216: Support terminal color output on Windows via colorama
-------------------------------------+-------------------------------------
     Reporter:  MinchinWeb           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  dev
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  windows, color,      |             Triage Stage:  Accepted
  colorama                           |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Leon Matthews):

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


Comment:

 This change has caused a 500 error on my sites because of the call to
 `colorama.init()` at ''import'' time. It is now preventing me from
 upgrading to Django 3.2 (it still works fine on Django 3.1.10).

 I understand that `colorama.init()` must be called at some point, but
 could it please be moved into a function instead? Maybe `colour_style()`?
 Running code at import time is usually bad practice, and can cause
 [https://www.benkuhn.net/importtime/ lots of problems]. In my case it is
 causing my server process to crash before it has a chance to be
 configured. My logging configuration doesn't use colour, but the import
 chain forces a run of `colorama.init()` anyway.

 I am running Ubuntu Server 20.04, Python 3.8, Apache2 and mod_wsgi with
 `WSGIRestrictStdout` set to its default value of ''on''. It is the latter
 that is the proximate cause of the problem as colorama accesses
 `sys.stdout` which is [https://modwsgi.readthedocs.io/en/master
 /configuration-directives/WSGIRestrictStdout.html prohibited by mod_wsgi]

 Thank you very much - and I hope this is the right place to bring this up.
 I was able track my problem down to this patch, so I haven't created a new
 issue.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31216#comment:6>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.3a185a64c381c5ddc885e58771eac3dc%40djangoproject.com.

Reply via email to