duqing2026's picture
fix: internal server error, add default data, optimize layout
198ccdc
raw
history blame contribute delete
640 Bytes
from flask import Flask, render_template, send_from_directory, jsonify
import os
app = Flask(__name__, static_folder='static')
@app.route('/')
def index():
try:
return render_template('index.html')
except Exception as e:
return f"An error occurred: {str(e)}", 500
@app.route('/health')
def health():
return jsonify({"status": "healthy"}), 200
# Flask serves static files automatically from the 'static' folder
# at the /static endpoint. No need for a manual route unless customizing.
if __name__ == '__main__':
port = int(os.environ.get('PORT', 7860))
app.run(debug=True, host='0.0.0.0', port=port)