Skip to content

Commit

Permalink
Apply override only for flask-compress >= 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Rivet committed Oct 6, 2020
1 parent 6a416d7 commit 01bfbcd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dash/dash.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function


import os
import sys
import collections
Expand All @@ -20,6 +21,7 @@
import flask
from flask_compress import Compress
from werkzeug.debug.tbtools import get_current_traceback
from pkg_resources import get_distribution, parse_version

import plotly
import dash_renderer
Expand Down Expand Up @@ -49,6 +51,8 @@
from . import _validate
from . import _watch

flask_compress_version = parse_version(get_distribution("flask-compress").version)

# Add explicit mapping for map files
mimetypes.add_type("application/json", ".map", True)

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

0 comments on commit 01bfbcd

Please sign in to comment.