Skip to content

Commit 72a0db7

Browse files
committed
Move dev_tools activation to method.
1 parent c8571cb commit 72a0db7

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

dash/dash.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def serve_component_suites(self, package_name, path_in_package_dist):
425425
'js': 'application/JavaScript',
426426
'css': 'text/css'
427427
})[path_in_package_dist.split('.')[-1]]
428+
428429
return Response(
429430
pkgutil.get_data(package_name, path_in_package_dist),
430431
mimetype=mimetype
@@ -953,11 +954,29 @@ def get_asset_url(self, path):
953954
self.config.routes_pathname_prefix,
954955
path)
955956

957+
def activate_dev_tools(self,
958+
dev_tools=True,
959+
dev_tools_bundles=True):
960+
"""
961+
Activate the dev tools, called by `run_server`. If your application is
962+
served by wsgi and you want to activate the dev tools, you can call
963+
this method out of `__main__`.
964+
965+
:param dev_tools: If false no tools will be activated.
966+
:type dev_tools: bool
967+
:param dev_tools_bundles: Serve the dev bundles of component libs.
968+
:type dev_tools_bundles: bool
969+
:return:
970+
"""
971+
if not dev_tools:
972+
return
973+
self._serve_dev_bundle = dev_tools_bundles
974+
956975
def run_server(self,
957976
port=8050,
958977
debug=False,
959978
dev_tools=True,
960-
dev_tools_bundles=False,
979+
dev_tools_bundles=True,
961980
**flask_run_options):
962981
"""
963982
Start the flask server in local mode, you should not run this on a
@@ -975,6 +994,6 @@ def run_server(self,
975994
:param flask_run_options: Given to `Flask.run`
976995
:return:
977996
"""
978-
self._serve_dev_bundle = dev_tools_bundles or dev_tools
997+
self.activate_dev_tools(dev_tools, dev_tools_bundles)
979998
self.server.run(port=port, debug=dev_tools or debug,
980999
**flask_run_options)

0 commit comments

Comments
 (0)