this POC project uses fast-api which is not installed on my local machine. I will config pycharm to use a remote interpreter from the container.
Let's go step by step:
- Open a terminal in the fapi directory.
- run
docker compose up --build -d
- Note that this doesn't give us autocomplete. Even though the code runs and reacts to changes in the file, that is because of the volume defined in the dokcer-compose.yaml file
- Click
ctrl
+shift
+s
- Go to the project python interpreter
- On the top right corner of the screen click
Add Interpreter
>On Docker compose
- Click
Apply
>Ok
- Click
Next
>Next
>Create
https://hub.docker.com/_/busybox
9* You will need to transfer that image to your air gapped network if you are using one. the following line is the relevent line when I run docker images
on my host machine
busybox latest a416a98b71e2 2 weeks ago 4.26MB
-
This will build (now offline) another image pycharm_helpers (and spin a container of course)
-
You now have intellisense from the IDE.
-
In order to debug we will need to make a debug run config
-
Click on the green triangle and then on
Debug main
-
This should make a run config. In case you need here is the one I made.