diff options
| author | areski <areski@gmail.com> | 2014-07-29 15:18:44 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-07-30 12:58:53 -0400 |
| commit | 67d7da5fb9498b811f0168f5df2308ad4743027f (patch) | |
| tree | f8eb36469229bb866e7eb8dcaa202487a1e586d3 | |
| parent | 7fcfefbc4a502c8bf390838be4fa726efb2036dd (diff) | |
Fixed #23107 -- Made runserver output respect --no-color.
| -rw-r--r-- | django/core/management/base.py | 1 | ||||
| -rw-r--r-- | tests/admin_scripts/tests.py | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/django/core/management/base.py b/django/core/management/base.py index 2f8664f128..0cce152176 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -380,6 +380,7 @@ class BaseCommand(object): if options.get('no_color'): self.style = no_style() self.stderr = OutputWrapper(options.get('stderr', sys.stderr)) + os.environ["DJANGO_COLORS"] = "nocolor" else: self.stderr = OutputWrapper(options.get('stderr', sys.stderr), self.style.ERROR) diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index b2da37b8d9..0d622699e7 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1385,6 +1385,7 @@ class CommandTypes(AdminScriptTestCase): out = StringIO() call_command('color_command', no_color=True, stdout=out) + self.assertEqual(os.environ.get('DJANGO_COLORS', ''), 'nocolor') self.assertEqual(out.getvalue(), 'BEGIN\n') def test_base_command(self): |
