From c42423f11394b2ef82684af09ed221de4ecb63d9 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 4 Sep 2020 01:05:47 +0300 Subject: Update how static js/ css files are fetched * wqflask/wqflask/views.p:(css, js) Add "css" router decorator. Also, if "js_alt" is in path, fetch the file from "GUIX_PROFILE/share/javascript" instead of the default directory: "GUIX_PROFILE/share/genenetwork2/javascript" See: --- wqflask/wqflask/views.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 91d1a279..fc9949a8 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -175,13 +175,24 @@ def tmp_page(img_path): return render_template("show_image.html", img_base64 = bytesarray ) + @app.route("/js/") def js(filename): - return send_from_directory(JS_GUIX_PATH, filename) + js_path = JS_GUIX_PATH + name = filename + if 'js_alt/' in filename: + js_path = js_path.replace('genenetwork2/javascript', 'javascript') + name = name.replace('js_alt/', '') + return send_from_directory(js_path, name) @app.route("/css/") def css(filename): - return send_from_directory(CSS_PATH, filename) + js_path = JS_GUIX_PATH + name = filename + if 'js_alt/' in filename: + js_path = js_path.replace('genenetwork2/javascript', 'javascript') + name = name.replace('js_alt/', '') + return send_from_directory(js_path, name) @app.route("/twitter/") def twitter(filename): -- cgit v1.2.3