zen-focus-flow / app.py
duqing2026's picture
升级优化
e8ebb5d
raw
history blame contribute delete
862 Bytes
import logging
import os
from flask import Flask, render_template, send_from_directory, jsonify
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
app = Flask(__name__)
# Change Jinja2 delimiters to avoid conflict with Vue.js
app.jinja_env.variable_start_string = '[['
app.jinja_env.variable_end_string = ']]'
@app.route('/')
def index():
try:
return render_template('index.html')
except Exception as e:
logger.error(f"Error rendering index: {e}")
return "Internal Server Error", 500
@app.route('/health')
def health():
return jsonify({"status": "healthy"})
@app.route('/static/<path:path>')
def send_static(path):
return send_from_directory('static', path)
if __name__ == '__main__':
port = int(os.environ.get('PORT', 7860))
app.run(host='0.0.0.0', port=port)