From 4b3ea65ed68fb054210ba2be3f949dca8c7d6b2c Mon Sep 17 00:00:00 2001 From: jonasled <jonas@jonasled.de> Date: Sun, 23 Feb 2020 21:53:02 +0100 Subject: [PATCH] added versioncheck --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index 8f0849b..8fba6fe 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ from os import environ #Used for getting the enviorement variables from itsdangerous import URLSafeSerializer #used for signing the cookies from random import choice#used for signing the cookies from string import ascii_lowercase #used for signing the cookies +from requests import get #used to get the current version on the Server #Import of shorter specific files from table_check import table_check #import the table check file @@ -197,6 +198,9 @@ def apiDocs(): def startup(): table_check()# This code checks whether database table is created or not + versionServer = get("https://gitlab.jonasled.de/jonasled/url_shorter_docker/raw/master/VERSION").text + if(open("VERSION", "r").read() != versionServer): print("Different version on the server found. Your version: " + open("VERSION", "r").read() + ", server version: " + versionServer + ".") + if production: #Check if production variable is set to true use the waitress webserver, else use the buildin flask webserver, with more debug output serve(app, host=host, port= 5000, url_scheme=url_scheme) #Start the Webserver for all users on port 5000 else: -- GitLab