From 03ba5bf1edcf4f7adec15b51d0d8e22274fd4a07 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Sun, 9 Oct 2016 10:42:33 +0000
Subject: Add version information
---
bin/genenetwork2 | 4 ++++
etc/default_settings.py | 1 +
wqflask/utility/tools.py | 1 +
wqflask/wqflask/templates/base.html | 26 +++++++++++++-------------
wqflask/wqflask/views.py | 6 +++---
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index b2de4c95..52d3155c 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -26,6 +26,10 @@ GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
echo GN2_BASE_DIR=$GN2_BASE_DIR
+GIT_HASH=$(git rev-parse HEAD)
+GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+export GN_VERSION=$(cat $GN2_BASE_DIR/VERSION)-$GIT_BRANCH-${GIT_HASH:0:9}
+echo GN_VERSION=$GN_VERSION
# Handle settings parameter (can be .py or .json)
settings=$1
diff --git a/etc/default_settings.py b/etc/default_settings.py
index d8e57f38..db645f8b 100644
--- a/etc/default_settings.py
+++ b/etc/default_settings.py
@@ -18,6 +18,7 @@
import os
import sys
+GN_VERSION = open("../VERSION","r").read()
SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s"
SQLALCHEMY_DATABASE_URI = 'mysql://gn2:mysql_password@localhost/db_webqtl_s'
SQLALCHEMY_POOL_RECYCLE = 3600
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index c6d8f7d2..90144962 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -197,6 +197,7 @@ def show_settings():
# Cached values
+GN_VERSION = get_setting('GN_VERSION')
HOME = get_setting('HOME')
WEBSERVER_MODE = get_setting('WEBSERVER_MODE')
GN_SERVER_URL = get_setting('GN_SERVER_URL')
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 946e6add..cf40fe3c 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -95,29 +95,27 @@
- {% block content %}{% endblock %}
+ {% block content %}
+ {% endblock %}
-
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 33fab84d..5528d375 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -51,7 +51,7 @@ from wqflask.wgcna import wgcna_analysis
from wqflask.ctl import ctl_analysis
from utility import temp_data
-from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL
+from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION
from base import webqtlFormData
from base.webqtlConfig import GENERATED_IMAGE_DIR
@@ -124,10 +124,10 @@ def index_page():
g.cookie_session.import_traits_to_user()
if USE_GN_SERVER:
# The menu is generated using GN_SERVER
- return render_template("index_page.html", gn_server_url = GN_SERVER_URL)
+ return render_template("index_page.html", gn_server_url = GN_SERVER_URL, version=GN_VERSION)
else:
# Old style static menu (OBSOLETE)
- return render_template("index_page_orig.html")
+ return render_template("index_page_orig.html", version=GN_VERSION)
@app.route("/tmp/")
--
cgit v1.2.3