- 标有 WIP 的表示暂不适用,后续解决 issue 后,会取消 WIP
使用 Fastapi 框架开发后台服务的模版
- Python3.9
- uvicorn main:app --host 0.0.0.0 --port 8080
- Fork repo:
git@git.yqslmall.com:sz-backend/flask-template.git
- Clone to forked repo to local.
git clone git@git.yqslmall.com:{your_gitlab_username}/flask-template.git
- Set upstream:
git remote add upstream git@git.yqslmall.com:sz-backend/flask-template.git
- 配置本地数据库表
- pip install -r requirements.txt
- python3 wsgi.py [port] 或 gunicorn -k gevent -c gunicorn_conf.py wsgi:app
- Run mysql:
docker run --rm --name test_db -p 53306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
- Create DB:
docker exec -it test_db mysql -u root -P 53306 -p
- enter password: root
CREATE DATABASE test_db
;
- Goto project directory, and run
tox
- IF you want to use
pytest
, should run following lines in shell:
export TEST_DB_URI=1
export TEST_DB_URI="mysql+pymysql://root:root@127.0.0.1:53306/test_db?charset=utf8mb4"
- python release patch | minor | major