base_fastapi

0 |

app

Start a project with:

docker-compose -f docker-compose.yml --project-directory . up

If you want to develop in docker with autoreload, use this command:

docker-compose -f docker-compose.yml -f docker-compose.dev.yml --project-directory . up

This command exposes application on port 8000, mounts current directory and enables autoreload.

But you have to rebuild image every time you modify poetry.lock or pyproject.toml with this command:

docker-compose -f docker-compose.yml --project-directory . build

Pre-commit

To install pre-commit simply run inside the shell:

pre-commit install

Migrations

If you want to migrate your database, you should run following commands:

# To run all migrations untill the migration with revision_id.
alembic upgrade "<revision_id>"

# To perform all pending migrations.
alembic upgrade "head"

Reverting migrations

If you want to revert migrations, you should run:

# revert all migrations up to: revision_id.
alembic downgrade <revision_id>

# Revert everything.
 alembic downgrade base

Migration generation

To generate migrations you should run:

# For automatic change detection.
alembic revision --autogenerate

# For empty file generation.
alembic revision
Sugestões
Veja meus outros repositórios
Ver mais