fix: 创建 .coze 配置文件,配置为Python Flask版本
问题:沙箱预览仍然使用旧的Node.js版本配置(scripts/dev.sh) 修复: 1. 创建 .coze 配置文件: - requires: python-3.12 - build: pip install -r requirements.txt - run: python app.py 2. 更新 app.py 端口配置: - 支持 DEPLOY_RUN_PORT(沙箱环境) - 支持 PORT(本地环境) - 默认 5000 现在沙箱预览会使用Python Flask版本。 请在IDE中重新启动预览: 1. 点击预览窗口的刷新按钮 2. 或关闭预览后重新打开 Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
4
app.py
4
app.py
@@ -467,6 +467,8 @@ print('定时任务已启动:每天 08:01 执行')
|
||||
# ==================== 启动应用 ====================
|
||||
|
||||
if __name__ == '__main__':
|
||||
port = int(os.environ.get('PORT', 5000))
|
||||
# 支持沙箱环境和本地环境
|
||||
port = int(os.environ.get('DEPLOY_RUN_PORT', os.environ.get('PORT', 5000)))
|
||||
print(f'启动服务器: http://localhost:{port}')
|
||||
print(f'数据库: {os.environ.get("DB_HOST", "haoslm2.xicp.net")}:{os.environ.get("DB_PORT", "10216")}')
|
||||
app.run(host='0.0.0.0', port=port, debug=True)
|
||||
Reference in New Issue
Block a user