Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/src/oncall/ui/__init__.py b/src/oncall/ui/__init__.py 2index a94fb17..364404a 100644 3--- a/src/oncall/ui/__init__.py 4+++ b/src/oncall/ui/__init__.py 5@@ -18,8 +18,12 @@ from webassets.ext.jinja2 import AssetsExtension 6 from webassets.script import CommandLineEnvironment 7 8 STATIC_ROOT = environ.get('STATIC_ROOT', path.abspath(path.dirname(__file__))) 9+SOURCE_ROOT = path.abspath(path.dirname(__file__)) 10 assets_env = AssetsEnvironment(path.join(STATIC_ROOT, 'static'), 11 url='/static') 12+assets_env.cache = False 13+assets_env.manifest = False 14+assets_env.load_path = [ path.join(SOURCE_ROOT, 'static') ] 15 16 assets_env.register('libs', Bundle( 17 'js/jquery-3.3.1.min.js', 'js/handlebars-4.0.12.min.js', 'js/bootstrap.min.js', 18@@ -45,7 +49,7 @@ logger = logging.getLogger('webassets') 19 logger.addHandler(logging.StreamHandler()) 20 21 jinja2_env = Jinja2Environment(extensions=[AssetsExtension], autoescape=True) 22-jinja2_env.loader = FileSystemLoader(path.join(STATIC_ROOT, 'templates')) 23+jinja2_env.loader = FileSystemLoader(path.join(SOURCE_ROOT, 'templates')) 24 jinja2_env.assets_environment = assets_env 25 26 _filename_ascii_strip_re = re.compile(r'[^A-Za-z0-9_.-]') 27@@ -113,14 +117,15 @@ def secure_filename(filename): 28 class StaticResource(object): 29 allow_no_auth = True 30 31- def __init__(self, path): 32+ def __init__(self, path, root): 33 self.path = path.lstrip('/') 34+ self.root = root 35 36 def on_get(self, req, resp, filename): 37 suffix = path.splitext(req.path)[1] 38 resp.content_type = mimes.get(suffix, 'application/octet-stream') 39 40- filepath = path.join(STATIC_ROOT, self.path, secure_filename(filename)) 41+ filepath = path.join(self.root, self.path, secure_filename(filename)) 42 try: 43 resp.stream = open(filepath, 'rb') 44 resp.content_length = path.getsize(filepath) 45@@ -153,8 +158,8 @@ def init(application, config): 46 47 application.add_sink(index, '/') 48 application.add_route('/static/bundles/{filename}', 49- StaticResource('/static/bundles')) 50+ StaticResource('/static/bundles', STATIC_ROOT)) 51 application.add_route('/static/images/{filename}', 52- StaticResource('/static/images')) 53+ StaticResource('/static/images', SOURCE_ROOT)) 54 application.add_route('/static/fonts/{filename}', 55- StaticResource('/static/fonts')) 56+ StaticResource('/static/fonts', SOURCE_ROOT))