File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 6
6
from urllib .parse import unquote_plus
7
7
import argparse
8
8
import dataclasses
9
+ import importlib_resources as resources
9
10
import json
10
11
import os
11
12
import sys
@@ -86,7 +87,7 @@ def handle_root():
86
87
87
88
@app .get ("/static/<filename:path>" )
88
89
def handle_static_filename (filename ):
89
- resp = bottle .static_file (filename , root = os . path . join ( os . path . dirname ( __file__ ), "static" ) )
90
+ resp = bottle .static_file (filename , root = app . config [ "helm.staticpath" ] )
90
91
resp .add_header ("Cache-Control" , "no-store, must-revalidate " )
91
92
return resp
92
93
@@ -284,6 +285,12 @@ def main():
284
285
ensure_directory_exists (sqlite_cache_path )
285
286
cache_backend_config = SqliteCacheBackendConfig (sqlite_cache_path )
286
287
288
+ static_package_name = "helm.proxy.static"
289
+ resource_path = resources .files (static_package_name ).joinpath ("index.html" )
290
+ with resources .as_file (resource_path ) as resource_filename :
291
+ static_path = str (resource_filename .parent )
292
+ app .config ["helm.staticpath" ] = static_path
293
+
287
294
service = ServerService (base_path = args .base_path , cache_backend_config = cache_backend_config )
288
295
289
296
gunicorn_args = {
You can’t perform that action at this time.
0 commit comments