Skip to content

xuanhuan95/fastapi_tortoise_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Setup dev environment

Init python environment

python3 -m venv .venv
source .venv/bin/activate # active python environment
pip install -r app/requirements.txt

Init .env file

cp app/.env.example app/.env

Run project

docker-compose up

Init database (for the first time)

  • Access docker container
docker ps # get all docker container running
  • result will have format like this
<api_container_id>   fastapi-template_api   "uvicorn main:app --…"   About a minute ago   Up About a minute   80/tcp, 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   fastapi-template_api_1
<redis_container_id>   redis:alpine           "docker-entrypoint.s…"   34 minutes ago       Up About a minute   6379/tcp                                            fastapi-template_redis_1
<postgres_container_id>   postgres               "docker-entrypoint.s…"   34 minutes ago       Up About a minute   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp           fastapi-template_db_1
  • get container id of fastapi-template_api then:
docker exec -it <api_container_id> bash
  • then run:
aerich init -t main.TORTOISE_ORM # init migrations folder and pyproject.toml config
aerich migrate # create migration file
aerich upgrade # apply migration change

Health Check

Documents

About

Fast API + Tortoise code template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published