From 1e0bcba568aeea3913858908a56676e64e849ad2 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 15 Mar 2018 17:17:04 -0700 Subject: [PATCH] Allowing config flag to turn off flask-compress (#4617) --- docs/installation.rst | 3 +++ superset/__init__.py | 3 ++- superset/config.py | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/installation.rst b/docs/installation.rst index 1e6e27d0ef19f..5cb4260544caf 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -173,6 +173,9 @@ work on Windows so the `superset runserver` command is not expected to work in that context. Also note that the development web server (`superset runserver -d`) is not intended for production use. +If not using gunicorn, you may want to disable the use of flask-compress +by setting `ENABLE_FLASK_COMPRESS = False` in your `superset_config.py` + Flask-AppBuilder Permissions ---------------------------- diff --git a/superset/__init__.py b/superset/__init__.py index fbf11c0780f6e..d420b764f3f7d 100644 --- a/superset/__init__.py +++ b/superset/__init__.py @@ -168,7 +168,8 @@ def index(self): ConnectorRegistry.register_sources(module_datasource_map) # Flask-Compress -Compress(app) +if conf.get('ENABLE_FLASK_COMPRESS'): + Compress(app) # Hook that provides administrators a handle on the Flask APP # after initialization diff --git a/superset/config.py b/superset/config.py index 87da811fbbaad..a7e721089ba33 100644 --- a/superset/config.py +++ b/superset/config.py @@ -405,6 +405,10 @@ class CeleryConfig(object): # return "-- [SQL LAB] {username} {dttm}\n sql"(**locals()) SQL_QUERY_MUTATOR = None +# When not using gunicorn, (nginx for instance), you may want to disable +# using flask-compress +ENABLE_FLASK_COMPRESS = True + try: if CONFIG_PATH_ENV_VAR in os.environ: # Explicitly import config module that is not in pythonpath; useful