Store your data on your self-hosted cloud
Start a project with:
docker-compose -f deploy/docker-compose.yml --project-directory . up
If you want to develop in docker with autoreload, use this command:
docker-compose -f deploy/docker-compose.yml -f deploy/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 deploy/docker-compose.yml --project-directory . build
To install pre-commit simply run inside the shell:
pre-commit install
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"
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
To generate migrations you should run:
# For automatic change detection.
alembic revision --autogenerate
# For empty file generation.
alembic revision
If you want to run it in docker, simply run:
docker-compose -f deploy/docker-compose.yml --project-directory . run --rm api pytest -vv .
docker-compose -f deploy/docker-compose.yml --project-directory . down
For running tests on your local machine.
- you need to start a database.
I prefer doing it with docker:
docker run -p "5432:5432" -e "POSTGRES_PASSWORD=file_storage" -e "POSTGRES_USER=file_storage" -e "POSTGRES_DB=file_storage" postgres:13.6-bullseye
- Run the pytest.
pytest -vv .