aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2020-09-04 01:05:47 +0300
committerBonfaceKilz2020-09-04 01:18:24 +0300
commitc42423f11394b2ef82684af09ed221de4ecb63d9 (patch)
tree24fd47ba2f9431bc9cd591947839fb13197f22ea
parent86fd0e0bec0c56ffa7857d9bf8c2c0dac25f99dc (diff)
downloadgenenetwork2-c42423f11394b2ef82684af09ed221de4ecb63d9.tar.gz
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: <https://github.com/genenetwork/genenetwork2/issues/436>
-rw-r--r--wqflask/wqflask/views.py15
1 files 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/<path:filename>")
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/<path:filename>")
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/<path:filename>")
def twitter(filename):