diff --git a/Back-End/API/.dockerignore b/Back-End/API/.dockerignore index b92a7d0..dfae634 100644 --- a/Back-End/API/.dockerignore +++ b/Back-End/API/.dockerignore @@ -1,5 +1,4 @@ __pycache__ .env env -tests -migrations/ \ No newline at end of file +tests \ No newline at end of file diff --git a/Back-End/API/migrations/setup.py b/Back-End/API/migrations/setup.py index 435e58b..51ed86d 100755 --- a/Back-End/API/migrations/setup.py +++ b/Back-End/API/migrations/setup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import enum import uuid import sqlalchemy @@ -9,7 +10,10 @@ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.postgresql import UUID -engine = create_engine('postgresql://root:password@localhost:5432/koic_detections', echo = True) +engine = create_engine( + os.getenv("DATABASE_URI", "postgresql://root:password@localhost:5432/koic_detections"), + echo = True +) Base = declarative_base() class Animals(enum.Enum): diff --git a/README.md b/README.md index 5318ad1..b77fd96 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ And save. Check that the above steps have been carried out. If you would test without pi run his command: ```bash +python3 -m pip install -r ./RPIProducer/requirements.txt ./RPIProducer/tests/fake_producer.py ``` diff --git a/RPIProducer/requirements.txt b/RPIProducer/requirements.txt new file mode 100644 index 0000000..e3ed3c0 --- /dev/null +++ b/RPIProducer/requirements.txt @@ -0,0 +1,3 @@ +kafka-python==2.0.2 +numpy==1.22.2 +opencv-contrib-python==4.5.5.62 diff --git a/launch.sh b/launch.sh index 1ff25ca..b271419 100755 --- a/launch.sh +++ b/launch.sh @@ -26,7 +26,7 @@ fi sleep 2 -if ./Back-End/API/migrations/setup.py &> /dev/null; then +if docker-compose --file Back-End/docker-compose.yml run api migrations/setup.py &> /dev/null; then printf "${GREEN}[ DONE ]${NC} Create table in DB\n" else printf "${RED}[ CRASH ]${NC} Create table in DB\n"