Skip to content

Commit bc6aa6e

Browse files
authored
Improve collectstatic verbosity levels (#50)
1 parent 97a4b19 commit bc6aa6e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

django_esm/management/commands/collectstatic.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ def handle(self, **options):
2525
"esimport",
2626
get_settings().PACKAGE_DIR,
2727
get_settings().STATIC_DIR,
28-
],
29-
stdout=sys.stdout,
28+
]
29+
+ (["--verbose"] if options["verbosity"] > 1 else []),
30+
stdout=sys.stdout if options["verbosity"] else subprocess.DEVNULL,
3031
stderr=sys.stderr,
3132
)
3233
try:
33-
import whitenoise # noqa
34+
import whitenoise.compress # noqa
3435
except ImportError:
3536
pass
3637
else:
@@ -41,7 +42,11 @@ def handle(self, **options):
4142
"whitenoise.compress",
4243
get_settings().STATIC_DIR,
4344
],
44-
stdout=sys.stdout,
45+
stdout=(
46+
sys.stdout if options["verbosity"] > 1 else subprocess.DEVNULL
47+
),
4548
stderr=sys.stderr,
4649
)
50+
if options["verbosity"]:
51+
self.stdout.write("ES modules compressed.")
4752
super().handle(**options)

django_esm/management/commands/esm.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def handle(self, *args, **options):
3737
]
3838
+ (["--watch"] if options["watch"] else [])
3939
+ (["--serve"] if options["serve"] else [])
40+
+ (["--verbose"] if options["verbosity"] > 1 else [])
4041
),
4142
stdout=sys.stdout,
4243
stderr=sys.stderr,

0 commit comments

Comments
 (0)