优化更新

This commit is contained in:
2026-09-13 23:01:19 +08:00
parent 0c67b3e8b5
commit 23bd737b82
88 changed files with 2214 additions and 2503 deletions
+13 -13
View File
@@ -57,7 +57,7 @@ cp .env.example .env
# ============================================================
DB_HOST=127.0.0.1 # 数据库主机地址(本地容器)
DB_PORT=3306 # 数据库端口(MySQL 默认 3306)
DB_DATABASE=djangoadmin.flask.elevue # 数据库名称
DB_DATABASE=djangoadmin.flask.naivevue # 数据库名称
DB_USERNAME=root # 数据库用户名
DB_PASSWORD=your_password # 数据库密码(请修改为实际密码)
DB_PREFIX=flask_ # 数据表前缀
@@ -88,12 +88,12 @@ python -c "import secrets; print(secrets.token_urlsafe(48))"
## Docker Compose 配置
项目的 `docker-compose.yml` 文件定义了后端服务的容器编排:
项目的 `docker/docker-compose.yml` 文件定义了后端服务的容器编排:
```yaml
# +======================================================================
# | 模块: Docker Compose 配置
# | 说明: Flask+EleVue 应用服务容器编排
# | 说明: Flask+NaiveUI 应用服务容器编排
# +======================================================================
version: '3.7'
# ============================================================
@@ -103,11 +103,11 @@ services:
# ------------------------------------------------------------
# 后端服务
# ------------------------------------------------------------
flask_elevue:
flask_naivevue:
# 构建镜像名称
image: flask_elevue
image: flask_naivevue
# 容器运行时名称
container_name: flask_elevue
container_name: flask_naivevue
# 镜像构建配置
build:
context: ./ # 构建上下文路径(项目根目录)
@@ -181,7 +181,7 @@ docker compose up -d
[+] Building 45.2s (12/12) FINISHED
[+] Running 2/2
✔ Network djangoadmin_default Created
✔ Container flask_elevue Started
✔ Container flask_naivevue Started
```
:::tip 访问服务
@@ -215,7 +215,7 @@ docker compose logs -f
docker compose logs --tail 100
# 查看指定服务日志
docker compose logs -f flask_elevue
docker compose logs -f flask_naivevue
```
+ 停止与重启
@@ -245,10 +245,10 @@ docker compose up --build
```bash
# 进入运行中的容器终端
docker compose exec flask_elevue bash
docker compose exec flask_naivevue bash
# 在容器内执行 Python 命令
docker compose exec flask_elevue python -c "print('hello')"
docker compose exec flask_naivevue python -c "print('hello')"
```
## 环境变量注入
@@ -257,10 +257,10 @@ Docker 模式下,环境变量通过 `env_file` 从 `.env` 文件注入到容
```bash
# 使用 --env-file 指定环境变量文件
docker run --env-file .env flask_elevue
docker run --env-file .env flask_naivevue
# 通过 -e 参数覆盖单个变量
docker run -e FLASK_PORT=9090 flask_elevue
docker run -e FLASK_PORT=9090 flask_naivevue
```
:::tip 温馨提示
@@ -315,7 +315,7 @@ ports:
```bash
# 查看容器日志排查原因
docker compose logs flask_elevue
docker compose logs flask_naivevue
```
常见原因:`JWT_SALT` 未配置、数据库连接失败、Redis 连接失败。