remove: monitoring(replaced by statping-ng); fix: template naming
This commit is contained in:
parent
053b573758
commit
341b725d5f
7 changed files with 6 additions and 45 deletions
34
app.py
34
app.py
|
@ -10,43 +10,15 @@ app = Flask(__name__)
|
|||
|
||||
@app.route("/imprint")
|
||||
def root():
|
||||
return render_template("imprint.html")
|
||||
return render_template("imprint.j2")
|
||||
|
||||
@app.route("/about")
|
||||
def about():
|
||||
return render_template("about.html")
|
||||
return render_template("about.j2")
|
||||
|
||||
@app.route("/")
|
||||
def homepage():
|
||||
return render_template("homepage.html")
|
||||
|
||||
@app.route("/monitoring")
|
||||
def monitoring():
|
||||
global git_status
|
||||
global website_status
|
||||
executor = ThreadPoolExecutor(2)
|
||||
executor.submit(monitor)
|
||||
return render_template("monitoring.html", git_status = git_status, website_status = website_status)
|
||||
|
||||
|
||||
def get_status(link):
|
||||
requested_site = requests.get(link)
|
||||
status_code = requested_site.status_code
|
||||
try:
|
||||
match status_code:
|
||||
case 200:
|
||||
return "ONLINE"
|
||||
case _:
|
||||
return "ERROR"
|
||||
except:
|
||||
return "OFFLINE"
|
||||
|
||||
def monitor():
|
||||
while True:
|
||||
git_status = get_status(os.environ['GIT_URL'])
|
||||
website_status = get_status(os.environ['WEBSITE_URL'])
|
||||
time.sleep(5)
|
||||
|
||||
return render_template("homepage.j2")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue