Files
infoscreen/server/wsgi.py
olaf 6639006d65 Refactoring of routes
group functionalities working
2025-06-29 06:58:23 +00:00

43 lines
1013 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# server/wsgi.py
import glob
import os
import sys
sys.path.append('/workspace')
from flask import Flask, jsonify, send_from_directory, request
from database import Session, engine
app = Flask(__name__)
# Blueprints importieren und registrieren
from routes.clients import clients_bp
from routes.groups import groups_bp
from routes.events import events_bp
app.register_blueprint(clients_bp)
app.register_blueprint(groups_bp)
app.register_blueprint(events_bp)
@app.route("/health")
def health():
return jsonify(status="ok")
@app.route("/")
def index():
return "Hello from InfoscreenAPI!"
@app.route("/screenshots/<uuid>")
def get_screenshot(uuid):
pattern = os.path.join("screenshots", f"{uuid}*.jpg")
files = glob.glob(pattern)
if not files:
return jsonify({"error": "Screenshot not found"}), 404
filename = os.path.basename(files[0])
return send_from_directory("screenshots", filename)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True)