Files
012-kaopeilian/backend/scripts/init_project.sh
111 998211c483 feat: 初始化考培练系统项目
- 从服务器拉取完整代码
- 按框架规范整理项目结构
- 配置 Drone CI 测试环境部署
- 包含后端(FastAPI)、前端(Vue3)、管理端

技术栈: Vue3 + TypeScript + FastAPI + MySQL
2026-01-24 19:33:28 +08:00

50 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "初始化考培练系统后端项目..."
# 创建虚拟环境
if [ ! -d "venv" ]; then
echo "创建虚拟环境..."
python3 -m venv venv
fi
# 激活虚拟环境
source venv/bin/activate
# 升级pip
pip install --upgrade pip
# 安装依赖
echo "安装项目依赖..."
pip install -r requirements/dev.txt
# 复制环境变量文件
if [ ! -f ".env" ]; then
echo "创建环境变量文件..."
cp .env.example .env
echo "请编辑 .env 文件配置必要的环境变量"
fi
# 创建必要的目录
echo "创建必要的目录..."
mkdir -p logs uploads
# 初始化pre-commit
if command -v pre-commit &> /dev/null; then
echo "配置pre-commit hooks..."
pre-commit install
fi
echo ""
echo "项目初始化完成!"
echo ""
echo "下一步:"
echo "1. 编辑 .env 文件配置数据库和AI平台信息"
echo "2. 启动MySQL和Redis服务"
echo "3. 运行 'alembic init migrations' 初始化数据库迁移"
echo "4. 运行 'alembic revision --autogenerate -m \"initial\"' 创建初始迁移"
echo "5. 运行 'alembic upgrade head' 应用迁移"
echo "6. 运行 'make run-dev' 启动开发服务器"
echo ""
echo "祝开发顺利! 🚀"