@@ -425,9 +425,14 @@ 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
+
429
+ headers = {
430
+ # 'Cache-Control': 'public, max-age=3600'
431
+ }
428
432
return Response (
429
433
pkgutil .get_data (package_name , path_in_package_dist ),
430
- mimetype = mimetype
434
+ mimetype = mimetype ,
435
+ headers = headers
431
436
)
432
437
433
438
def index (self , * args , ** kwargs ): # pylint: disable=unused-argument
@@ -953,11 +958,29 @@ def get_asset_url(self, path):
953
958
self .config .routes_pathname_prefix ,
954
959
path )
955
960
961
+ def activate_dev_tools (self ,
962
+ dev_tools = True ,
963
+ dev_tools_bundles = True ):
964
+ """
965
+ Activate the dev tools, called by `run_server`. If your application is
966
+ served by wsgi and you want to activate the dev tools, you can call
967
+ this method out of `__main__`.
968
+
969
+ :param dev_tools: If false no tools will be activated.
970
+ :type dev_tools: bool
971
+ :param dev_tools_bundles: Serve the dev bundles of component libs.
972
+ :type dev_tools_bundles: bool
973
+ :return:
974
+ """
975
+ if not dev_tools :
976
+ return
977
+ self ._serve_dev_bundle = dev_tools_bundles
978
+
956
979
def run_server (self ,
957
980
port = 8050 ,
958
981
debug = False ,
959
982
dev_tools = True ,
960
- dev_tools_bundles = False ,
983
+ dev_tools_bundles = True ,
961
984
** flask_run_options ):
962
985
"""
963
986
Start the flask server in local mode, you should not run this on a
@@ -975,6 +998,6 @@ def run_server(self,
975
998
:param flask_run_options: Given to `Flask.run`
976
999
:return:
977
1000
"""
978
- self ._serve_dev_bundle = dev_tools_bundles or dev_tools
1001
+ self .activate_dev_tools ( dev_tools , dev_tools_bundles )
979
1002
self .server .run (port = port , debug = dev_tools or debug ,
980
1003
** flask_run_options )
0 commit comments