import os from flask import Flask, render_template, send_from_directory, jsonify from jinja2.exceptions import TemplateNotFound app = Flask(__name__) @app.route('/') def index(): try: return render_template('index.html') except TemplateNotFound: return "Error: Template 'index.html' not found. Please ensure it exists in the 'templates' directory.", 404 except Exception as e: return f"Internal Server Error: {str(e)}", 500 @app.errorhandler(404) def page_not_found(e): return "Page not found", 404 @app.errorhandler(500) def internal_server_error(e): return "Internal Server Error", 500 @app.route('/health') def health_check(): return jsonify({"status": "healthy", "message": "App is running"}) @app.route('/static/') def send_static(path): return send_from_directory('static', path) if __name__ == '__main__': app.run(host='0.0.0.0', port=7860)