Skip to content

Commit 01bfbcd

Browse files
author
Marc-André Rivet
committed
Apply override only for flask-compress >= 1.6.0
1 parent 6a416d7 commit 01bfbcd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: dash/dash.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import print_function
22

3+
34
import os
45
import sys
56
import collections
@@ -20,6 +21,7 @@
2021
import flask
2122
from flask_compress import Compress
2223
from werkzeug.debug.tbtools import get_current_traceback
24+
from pkg_resources import get_distribution, parse_version
2325

2426
import plotly
2527
import dash_renderer
@@ -49,6 +51,8 @@
4951
from . import _validate
5052
from . import _watch
5153

54+
flask_compress_version = parse_version(get_distribution("flask-compress").version)
55+
5256
# Add explicit mapping for map files
5357
mimetypes.add_type("application/json", ".map", True)
5458

@@ -280,7 +284,9 @@ def __init__(
280284
elif isinstance(server, bool):
281285
name = name if name else "__main__"
282286
self.server = flask.Flask(name) if server else None
283-
if self.server is not None:
287+
if self.server is not None and flask_compress_version >= parse_version(
288+
"1.6.0"
289+
):
284290
# flask-compress==1.6.0 changed default to ['br', 'gzip']
285291
# and non-overridable default compression with Brotli is
286292
# causing performance issues

0 commit comments

Comments
 (0)