网页框架部署成功

This commit is contained in:
2025-09-04 16:03:09 +08:00
parent 71a648fdf4
commit 6f850caad1
16 changed files with 287 additions and 96 deletions

14
backend/.env.production Normal file
View File

@@ -0,0 +1,14 @@
# 生产环境配置
# MongoDB配置
MONGO_URI=mongodb://用户名:密码@主机地址:端口/InfoGenie?authSource=admin
# 邮件配置
MAIL_USERNAME=your-email@qq.com
MAIL_PASSWORD=your-app-password
# 应用密钥
SECRET_KEY=infogenie-production-secret-key-2025
# 会话安全配置
SESSION_COOKIE_SECURE=True

View File

@@ -31,7 +31,7 @@ def create_app():
# 加载配置
app.config.from_object(Config)
# 启用CORS跨域支持
# 启用CORS跨域支持(允许所有源)
CORS(app, supports_credentials=True)
# 初始化MongoDB
@@ -182,6 +182,4 @@ def create_app():
if __name__ == '__main__':
app = create_app()
print("🚀 启动 InfoGenie 后端服务...")
print("📡 API地址: http://localhost:5000")
print("📚 文档地址: http://localhost:5000/api/health")
app.run(debug=True, host='0.0.0.0', port=5000)
app.run(debug=True, host='0.0.0.0', port=5002)

27
backend/deploy.bat Normal file
View File

@@ -0,0 +1,27 @@
@echo off
echo ===== 开始部署后端应用到生产环境 =====
cd /d "%~dp0"
echo 1. 安装依赖...
pip install -r requirements.txt
echo 2. 部署说明:
echo.
echo 请确保以下配置已完成:
echo 1. 在服务器上配置环境变量或创建 .env 文件,包含以下内容:
echo MONGO_URI=你的MongoDB连接字符串
echo MAIL_USERNAME=你的邮箱地址
echo MAIL_PASSWORD=你的邮箱授权码
echo SECRET_KEY=你的应用密钥
echo.
echo 3. 启动后端服务:
echo 在生产环境中,建议使用 Gunicorn 或 uWSGI 作为 WSGI 服务器
echo 示例命令gunicorn -w 4 -b 0.0.0.0:5000 "app:create_app()"
echo.
echo 4. 配置反向代理:
echo 将 https://infogenie.api.shumengya.top 反向代理到后端服务
echo.
echo ===== 后端应用部署准备完成 =====
pause

View File

@@ -73,10 +73,13 @@ def scan_directories():
except:
title = module_name
# 根据环境获取基础URL
base_url = 'https://infogenie.api.shumengya.top'
apis.append({
'title': title,
'description': f'{module_name}相关功能',
'link': f'http://localhost:5000/60sapi/{category_name}/{module_name}/index.html',
'link': f'{base_url}/60sapi/{category_name}/{module_name}/index.html',
'status': 'active',
'color': gradient_colors[i % len(gradient_colors)]
})