Adrianux.net/app.py
ahoemann e696b2a10b
All checks were successful
/ update (push) Successful in 0s
feat: site status
2024-11-29 16:50:23 +01:00

42 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python3
from flask import Flask, render_template, redirect, url_for
import requests
app = Flask(__name__)
navigation = {"Imprint":"imprint"}
@app.route("/imprint")
def root():
return render_template("imprint.html")
@app.route("/about")
def about():
return render_template("about.html")
@app.route("/")
def homepage():
return render_template("homepage.html")
@app.route("/monitoring")
def monitoring():
git_status = get("http://localhost:5000")
website_status = get("http://localhost:5000")
return render_template("monitoring.html", git_status = git_status, website_status = website_status )
def get_status_code(link):
requested_site = requests.get(link)
return requested_site.status_code
def get(link):
match get_status_code(link):
case 200:
print(200)
return "<span style=green>ONLINE</span>"
case 500:
print(500)
return "<span style=orange>ERROR</span>"
case _:
print("OTHER")
return "<span style=red>OFFLINE</span>"
if __name__ == "__main__":
app.run(debug=True)