You can choose between Pycharm (Professional Edition) and VsCode as a development environment.
In the following steps, only the variant in the selected development environment needs to be executed.
cp .env.EXAMPLE .envClone the setup project and follow the instructions
git config core.hooksPath ./.githookschmod 744 ./.githooks/pre-commit
chmod 744 ./.githooks/commit-msgdocker compose -f ./.githooks/docker/pre-commit/docker-compose.yml up -dSettings -> "Seach" Python interpreter -> add interpreter (Button on the right of current interpreter) -> On Docker...Pull or use existing image- Select Docker image (Probably contains flask in its name)
- You can find it using Docker Desktop
Source: dev.to
- Install the Python extension
- Install the Dev - Containers extension
- Open the Command Palette and type
Dev-Containers, then select theAttach to Running Container...and select the running docker container (flask) - VS Code will restart and reload
- On the Explorer sidebar, click the open a folder button and then enter
/app(this will be loaded from the remote container) - On the Extensions sidebar, select the Python extension and install it on the container
- (When prompted on which interpreter to use, select
/usr/local/bin/python) - (Open the Command Palette and type Python: Configure Tests, then select the unittest framework)
- We use Black to format the python code
- install black
pip install black- OR
Settings -> Tools -> Black --> install black...
- run black on save
Settings -> Tools -> Actions on save --> "check" run black
- Install Black Formatter (inside the dev-container environment)
Settings -> Seach "Default Formatter"Settings -> Text Editor -> Format on Save
- Click Database Icon (top right)
+ -> Data Source -> PostgreSQL- Host:
0.0.0.0 - Port:
5432 - User:
user - Password:
s3cr3t - Database:
annotation_db
- Host:
OK
TODO
- Inside docker-image
annotation_backend, open terminal - run
flask db init(must only run once) - After every change in data model:
- run
flask db migrate - run
flask db upgrade - If an error occurs during these steps, try:
- run
flask db stamp head - run migrate + upgrade again
- run