This is python, fastapi, postgres and docker quickstart template for Hexagonal Architecture projects.
This is an ongoing work in progress and is based on Shako Rzayev's hexagonal architecture repositories combined with Python Alicante's meetup selector repository for docker setup.
Pull down the files to your empty initialized repo.
Unzip the files and delete the repo.zip file.
Copy the files to the root of your repo.
Delete the downloaded repo.zip file and the unzipped subfolder.
curl -sL https://github.com/davidjnevin/template-python-fastapi-docker-postgres/archive/master.zip -o repo.zip
unzip repo.zip
cp -r template-python-fastapi-docker-postgres-main/ .
rm -rf template-python-fastapi-docker-postgres-main
Update the repo url in pyproject.toml
.
Change 'appname' and description in src/appname/__init__.py
Change 'appname' folder to the project name.
Change 'appname' to the project name in:
MakeFile
(migrations, migrate and run commands)pyproject.toml
Install pre-commit
pre-commit install
Create and then edit the .env file
cp example.env .env
make help
For local development
make setup && make install-dev
Start Docker container - neccessary for testing
make build
Note: I am using a requirements.txt and requirements-dev.txt until I understand how to use Flit
in a docker build. This may change soon, but for the moment neccessitates copying from pyproject to the requirement files.