Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tx7do/fastapi-poetry-demo
https://github.com/tx7do/fastapi-poetry-demo
fastapi makefile minio poetry pytest python python3 redis swagger-ui tortoise-orm
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tx7do/fastapi-poetry-demo
- Owner: tx7do
- License: mit
- Created: 2023-07-22T11:58:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-29T03:45:54.000Z (7 months ago)
- Last Synced: 2024-05-29T16:33:44.660Z (7 months ago)
- Topics: fastapi, makefile, minio, poetry, pytest, python, python3, redis, swagger-ui, tortoise-orm
- Language: Python
- Homepage:
- Size: 387 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastapi-poetry-demo
## 技术栈
- [Python](https://www.python.org/)
- [Poetry](https://python-poetry.org/)
- [FastAPI](https://fastapi.tiangolo.com/)
- [Tortoise ORM](https://tortoise.github.io/)## 运行时环境需求
- Ubuntu 22.04 LTS
- Python 3.9+## 安装Poetry
通过安装脚本进行安装(可以保证安装到最新的版本):
```bash
curl -sSL https://install.python-poetry.org | python3 -
```将配置添加到`.bashrc`:
```bash
export PATH="/home/ubuntu/.local/bin:$PATH"
```## 初始化项目,下载依赖项
```bash
poetry install
```## 导出依赖项配置到requirements.txt
```bash
poetry export --output config/requirements.txt
```不导出Hash:
```bash
poetry export -f requirements.txt --output config/requirements-prod.txt --without-hashes
```## 运行服务
```bash
poetry run python3 app/main.py
```## 运行测试
测试全部用例:
```bash
pytest
```测试API:
```bash
pytest tests/api -v -s
```测试数据库增删改查:
```bash
pytest tests/crud -v -s
```## 访问API文档
- Swagger:
- Redoc: