@@ -425,6 +425,7 @@ def serve_component_suites(self, package_name, path_in_package_dist):
425
425
'js' : 'application/JavaScript' ,
426
426
'css' : 'text/css'
427
427
})[path_in_package_dist .split ('.' )[- 1 ]]
428
+
428
429
return Response (
429
430
pkgutil .get_data (package_name , path_in_package_dist ),
430
431
mimetype = mimetype
@@ -953,11 +954,29 @@ def get_asset_url(self, path):
953
954
self .config .routes_pathname_prefix ,
954
955
path )
955
956
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
+
956
975
def run_server (self ,
957
976
port = 8050 ,
958
977
debug = False ,
959
978
dev_tools = True ,
960
- dev_tools_bundles = False ,
979
+ dev_tools_bundles = True ,
961
980
** flask_run_options ):
962
981
"""
963
982
Start the flask server in local mode, you should not run this on a
@@ -975,6 +994,6 @@ def run_server(self,
975
994
:param flask_run_options: Given to `Flask.run`
976
995
:return:
977
996
"""
978
- self ._serve_dev_bundle = dev_tools_bundles or dev_tools
997
+ self .activate_dev_tools ( dev_tools , dev_tools_bundles )
979
998
self .server .run (port = port , debug = dev_tools or debug ,
980
999
** flask_run_options )
0 commit comments