From 23eddf927d77cce3aab326bb0de03f8c203b4d43 Mon Sep 17 00:00:00 2001 From: Chris P Date: Wed, 26 Feb 2020 18:12:00 -0500 Subject: [PATCH 1/2] :wrench: allow gzip to be set via env --- CHANGELOG.md | 4 ++++ dash/_configs.py | 3 ++- dash/dash.py | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6028f4751c..759bd7b8f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `dash` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] +### Added +- [#1132](github.com/plotly/dash/pull/1132) Allow the `compress` config variable to be set with an environment variable with DASH_COMPRESS=FALSE + ## [1.9.0] - 2020-02-04 ### Fixed - [#1080](https://github.com/plotly/dash/pull/1080) Handle case where dash fails to load when used inside an iframe with a sandbox attribute that only has allow-scripts diff --git a/dash/_configs.py b/dash/_configs.py index c93fca5eba..0c4fae55b4 100644 --- a/dash/_configs.py +++ b/dash/_configs.py @@ -29,12 +29,13 @@ def load_dash_env_vars(): 'DASH_HOT_RELOAD_MAX_RETRY', 'DASH_SILENCE_ROUTES_LOGGING', 'DASH_PRUNE_ERRORS', + 'DASH_COMPRESS' ) } ) -DASH_ENV_VARS = load_dash_env_vars() +DASH_ENV_VARS = load_dash_env_vars() # used in tests def get_combined_config(name, val, default=None): diff --git a/dash/dash.py b/dash/dash.py index 679ed0ee9a..4a702aab6d 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -221,7 +221,7 @@ def __init__( requests_pathname_prefix=None, routes_pathname_prefix=None, serve_locally=True, - compress=True, + compress=None, meta_tags=None, index_string=_default_index, external_scripts=None, @@ -276,7 +276,9 @@ def __init__( routes_pathname_prefix=routes_prefix, requests_pathname_prefix=requests_prefix, serve_locally=serve_locally, - compress=compress, + compress=get_combined_config( + "compress", compress, True + ), meta_tags=meta_tags or [], external_scripts=external_scripts or [], external_stylesheets=external_stylesheets or [], From b7154ea11c703e0a5e678e5bc2ad3f052f0df453 Mon Sep 17 00:00:00 2001 From: Chris P Date: Wed, 26 Feb 2020 18:12:40 -0500 Subject: [PATCH 2/2] :pencil: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 759bd7b8f1..82386318d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added -- [#1132](github.com/plotly/dash/pull/1132) Allow the `compress` config variable to be set with an environment variable with DASH_COMPRESS=FALSE +- [#1133](github.com/plotly/dash/pull/1133) Allow the `compress` config variable to be set with an environment variable with DASH_COMPRESS=FALSE ## [1.9.0] - 2020-02-04 ### Fixed