Spaces:
Configuration error
Configuration error
File size: 939 Bytes
2bc224f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from flask import Flask, jsonify
import os
import sys
# 创建一个非常简单的Flask应用实例
app = Flask(__name__)
# 获取当前Python版本,用于诊断
python_version = sys.version
@app.route('/')
def home():
"""一个简单的主页路由,返回HTML"""
# 打印日志,确认请求已到达
print(">>> [Test App] Home route '/' was accessed.")
return "<h1>Hello, TCM Expert Builder!</h1><p>The basic Flask app is running correctly.</p>"
@app.route('/health')
def health_check():
"""一个健康检查API端点,返回JSON"""
print(">>> [Test App] Health check '/health' was accessed.")
return jsonify({
"status": "ok",
"message": "The Gunicorn server is up and responding.",
"python_version": python_version,
"app_cwd": os.getcwd() # 打印当前工作目录
})
# 这个文件不需要 if __name__ == '__main__':, 因为gunicorn会直接导入app实例 |