Skip to content

Commit 20b388e

Browse files
Bugfix/fastapi postgres (keploy#34)
* Added container name in docker-compose.yml Container name for database not given in this file. Thus, unable to start the application. * Updating changes in README.md When running natively on docker, changes need to be done in main.py & database.py from local host to container name. * Update README.md
1 parent 28f4700 commit 20b388e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

fastapi-postgres/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ curl -O -L https:///keploy.io/install.sh && source install.sh
3232
docker-compose up -d
3333
```
3434

35+
> **Since we have setup our sample-app natively, we need to update the container name to postgres on line 6, in `application/database.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.**
36+
37+
> **Also, we need to update the container name to postgres on line 11, of `application/main.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.**
38+
3539
### Capture the Testcases
3640

3741
This command will start the recording of API calls :

fastapi-postgres/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33

44
postgres:
55
image: postgres:latest
6+
container_name: postgres
67
environment:
78
POSTGRES_DB: studentdb
89
POSTGRES_USER: postgres
@@ -30,4 +31,4 @@ services:
3031

3132
networks:
3233
keploy-network:
33-
external: true
34+
external: true

0 commit comments

Comments
 (0)