duqing2026's picture
解决部署问题
1455a00
raw
history blame contribute delete
941 Bytes
from flask import Flask, render_template, send_from_directory, jsonify
import os
import logging
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
app = Flask(__name__)
# Log startup
logger.info("Starting Growth Loop Simulator application...")
@app.route('/')
def index():
try:
return render_template('index.html')
except Exception as e:
app.logger.error(f"Error rendering index: {e}")
return f"Internal Server Error: {e}", 500
@app.route('/health')
def health():
return jsonify({"status": "healthy"}), 200
# Removed manual static route to rely on Flask's native static file handling
# ensuring standard behavior and reducing potential path resolution bugs.
if __name__ == '__main__':
# Log that we are using the __main__ entry point
logger.info("Starting via python app.py on port 7860...")
app.run(host='0.0.0.0', port=7860, debug=False)