Add files via upload

This commit is contained in:
jasonMPM
2026-03-04 20:56:30 -06:00
committed by GitHub
parent fc8a49ea6b
commit f74b5fd7c5
2 changed files with 180 additions and 48 deletions

10
app.py
View File

@@ -25,7 +25,6 @@ def get_db():
return conn
@app.before_first_request
def init_db():
conn = get_db()
conn.executescript("""
@@ -248,12 +247,15 @@ def send_static(path):
# ── Startup ───────────────────────────────────────────────────────────────────
# Initialise DB and kick off background scheduler at import time
# (works whether started via `flask run` or `python app.py`)
with app.app_context():
init_db()
sync_unifi_users()
scheduler = BackgroundScheduler()
scheduler.add_job(sync_unifi_users, "interval", hours=6)
scheduler.start()
if __name__ == "__main__":
with app.app_context():
init_db()
sync_unifi_users()
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8000)))