summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2021-05-12 15:22:34 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2021-05-19 11:16:13 +0200
commita173202dd475a454164bf4eeb528f183a85481c5 (patch)
tree3b5b27f932c819d7ab74ea325620ac30c19894f5
parentd743c373263d1ce64c34ce39fd7319a67a145858 (diff)
downloaddjango-a173202dd475a454164bf4eeb528f183a85481c5.tar.gz
[3.2.x] Fixed #32740 -- Caught possible exception when initializing colorama.
Backport of c2e6047c725e26987c87e2be59f2ab4bf9828fa5 from main
-rw-r--r--django/core/management/color.py4
-rw-r--r--docs/releases/3.2.4.txt4
2 files changed, 6 insertions, 2 deletions
diff --git a/django/core/management/color.py b/django/core/management/color.py
index 3227809303..be8c31bb95 100644
--- a/django/core/management/color.py
+++ b/django/core/management/color.py
@@ -10,10 +10,10 @@ from django.utils import termcolors
try:
import colorama
-except ImportError:
+ colorama.init()
+except (ImportError, OSError):
HAS_COLORAMA = False
else:
- colorama.init()
HAS_COLORAMA = True
diff --git a/docs/releases/3.2.4.txt b/docs/releases/3.2.4.txt
index dac726e961..048eb8c385 100644
--- a/docs/releases/3.2.4.txt
+++ b/docs/releases/3.2.4.txt
@@ -18,3 +18,7 @@ Bugfixes
* Prevented unnecessary initialization of unused caches following a regression
in Django 3.2 (:ticket:`32747`).
+
+* Fixed a crash in Django 3.2 that could occur when running ``mod_wsgi`` with
+ the recommended settings while the Windows ``colorama`` library was installed
+ (:ticket:`32740`).