first commit

This commit is contained in:
eason 2026-01-21 13:43:18 +08:00
parent a2e3b986e6
commit 1451d5f616
1 changed files with 30 additions and 0 deletions

30
README.md Normal file
View File

@ -0,0 +1,30 @@
## 启动项目(本地)
1. 准备环境
- 推荐 Python 3.11+
- 创建并激活虚拟环境:`python3 -m venv .venv && source .venv/bin/activate`
- 依赖安装:`pip install -r requirements.txt`(若 requirements.txt 为 UTF-16需要先转 UTF-8
2. 配置数据库
- 确保本地 MySQL 运行,并创建数据库/账号(例):
```sql
CREATE DATABASE allm DEFAULT CHARACTER SET utf8mb4;
ALTER USER 'root'@'localhost' IDENTIFIED BY '13813746735';
GRANT ALL PRIVILEGES ON allm.* TO 'root'@'localhost';
FLUSH PRIVILEGES;
```
- 启动前设置环境变量:
```bash
export DATABASE_URL=""
```
3. 迁移(首次必跑)
```bash
python -m alembic upgrade head
```
4. 启动服务
```bash
# 启动项目命令
python3 -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```