From 6c98bf364af47f79b24b884a880041168cfb1211 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 6 Mar 2018 21:19:29 -0800 Subject: [PATCH] Setting up compression using flask-compress (#4543) (cherry picked from commit d817b8ddbb3a8a1bd706f47ecd0934781aea100f) --- setup.py | 1 + superset/__init__.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/setup.py b/setup.py index 682fe336d89a4..ad33dcec587a2 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ def get_git_sha(): 'flask-cache==0.13.1', 'flask-migrate==2.1.1', 'flask-script==2.0.6', + 'flask-compress==1.4.0', 'flask-sqlalchemy==2.1', 'flask-testing==0.7.1', 'flask-wtf==0.14.2', diff --git a/superset/__init__.py b/superset/__init__.py index 0e876ee1f3043..536677236dd18 100644 --- a/superset/__init__.py +++ b/superset/__init__.py @@ -13,6 +13,7 @@ from flask import Flask, redirect from flask_appbuilder import AppBuilder, IndexView, SQLA from flask_appbuilder.baseviews import expose +from flask_compress import Compress from flask_migrate import Migrate from flask_wtf.csrf import CSRFProtect from werkzeug.contrib.fixers import ProxyFix @@ -174,6 +175,9 @@ def index(self): module_datasource_map.update(app.config.get('ADDITIONAL_MODULE_DS_MAP')) ConnectorRegistry.register_sources(module_datasource_map) +# Flask-Compress +Compress(app) + # Hook that provides administrators a handle on the Flask APP # after initialization flask_app_mutator = app.config.get('FLASK_APP_MUTATOR')