From 3d764eb6055686354feb4787104086377fba11a7 Mon Sep 17 00:00:00 2001 From: Bui Date: Wed, 10 Oct 2018 22:15:16 +0100 Subject: [PATCH] check if version file exists --- app.py | 4 +++- templates/index.html | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 385e16b..66a2166 100644 --- a/app.py +++ b/app.py @@ -69,7 +69,9 @@ def close_connection(exception): @app.route('/') def route_index(): - version = json.load(open('version.json', 'r')) + version = None + if os.path.isfile('version.json'): + version = json.load(open('version.json', 'r')) return render_template('index.html', version=version) diff --git a/templates/index.html b/templates/index.html index b8a0251..240953d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -56,7 +56,13 @@
-
taiko-web ver.{{version.version}} ({{version.commit_short}})
+
+ {% if version %} + taiko-web ver.{{version.version}} ({{version.commit_short}}) + {% else %} + taiko-web (unknown version) + {% endif %} +
\ No newline at end of file