网页框架部署成功
This commit is contained in:
59
README.md
59
README.md
@@ -6,6 +6,11 @@
|
||||
|
||||
InfoGenie 是一个前后端分离的多功能聚合应用,提供实时数据接口、休闲游戏、AI工具等丰富功能。
|
||||
|
||||
### 🌐 部署环境
|
||||
|
||||
- **前端部署地址**: https://infogenie.shumengya.top
|
||||
- **后端部署地址**: https://infogenie.api.shumengya.top
|
||||
|
||||
### 🏗️ 技术架构
|
||||
|
||||
- **前端**: React + Styled Components + React Router
|
||||
@@ -48,6 +53,60 @@ cd backend
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## 🚢 部署指南
|
||||
|
||||
### 🖥️ 前端部署
|
||||
|
||||
1. 进入前端目录:`cd frontend/react-app`
|
||||
2. 安装依赖:`npm install`
|
||||
3. 构建生产环境应用:`npm run build`
|
||||
4. 将 `build` 目录下的所有文件上传到前端服务器的网站根目录
|
||||
|
||||
也可以直接运行 `frontend/react-app/deploy.bat` 脚本进行构建。
|
||||
|
||||
### ⚙️ 后端部署
|
||||
|
||||
1. 进入后端目录:`cd backend`
|
||||
2. 安装依赖:`pip install -r requirements.txt`
|
||||
3. 配置环境变量或创建 `.env` 文件,包含以下内容:
|
||||
```
|
||||
MONGO_URI=你的MongoDB连接字符串
|
||||
MAIL_USERNAME=你的邮箱地址
|
||||
MAIL_PASSWORD=你的邮箱授权码
|
||||
SECRET_KEY=你的应用密钥
|
||||
SESSION_COOKIE_SECURE=True
|
||||
```
|
||||
4. 使用 Gunicorn 或 uWSGI 作为 WSGI 服务器启动应用:
|
||||
```
|
||||
gunicorn -w 4 -b 0.0.0.0:5000 "app:create_app()"
|
||||
```
|
||||
5. 配置反向代理,将 `https://infogenie.api.shumengya.top` 反向代理到后端服务
|
||||
|
||||
也可以参考 `backend/deploy.bat` 脚本中的部署说明。
|
||||
|
||||
### ⚙️ 配置说明
|
||||
|
||||
#### 前端配置
|
||||
|
||||
前端通过环境变量配置API基础URL:
|
||||
|
||||
- 开发环境:`.env.development` 文件中设置 `REACT_APP_API_URL=http://localhost:5000`
|
||||
- 生产环境:`.env.production` 文件中设置 `REACT_APP_API_URL=https://infogenie.api.shumengya.top`
|
||||
|
||||
#### 后端配置
|
||||
|
||||
后端通过 `config.py` 和环境变量进行配置:
|
||||
|
||||
- MongoDB连接:通过环境变量 `MONGO_URI` 设置
|
||||
- 邮件服务:通过环境变量 `MAIL_USERNAME` 和 `MAIL_PASSWORD` 设置
|
||||
- CORS配置:在 `app.py` 中配置允许的前端域名
|
||||
|
||||
#### 60sAPI配置
|
||||
|
||||
60sAPI模块的静态文件位于 `frontend/60sapi` 目录,通过后端的静态文件服务提供访问。
|
||||
|
||||
各API模块的接口地址已配置为 `https://infogenie.api.shumengya.top/api/60s`。
|
||||
|
||||
#### 前端依赖
|
||||
```bash
|
||||
cd frontend/react-app
|
||||
|
||||
Reference in New Issue
Block a user