Skip to content

Commit

Permalink
Merge pull request #245 from healthy-food-and-dietary-products/featur…
Browse files Browse the repository at this point in the history
…e/change-hardcoded-paths-in-frontend

Change docker compose frontend settings to add .env functionality, ed…
  • Loading branch information
earlinn authored Jan 29, 2024
2 parents f7aa89d + 944dfdb commit b7705db
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ __pycache__/
db.sqlite3
dump.json
*.log
*.csv
/backend/media/
/backend/static/
.env
2 changes: 2 additions & 0 deletions .github/workflows/good_food_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ jobs:
echo STRIPE_PUBLISHABLE_KEY=${{ secrets.STRIPE_PUBLISHABLE_KEY }} >> .env
echo STRIPE_SECRET_KEY=${{ secrets.STRIPE_SECRET_KEY }} >> .env
echo STRIPE_WEBHOOK_SECRET=${{ secrets.STRIPE_WEBHOOK_SECRET }} >> .env
echo VITE_API_URL=${{ secrets.VITE_API_URL }} >> .env
echo VITE_BASE_URL=${{ secrets.VITE_BASE_URL }} >> .env
sudo docker compose up -d
sudo docker image prune -f
sudo docker compose exec -T web python manage.py collectstatic --no-input
Expand Down
12 changes: 7 additions & 5 deletions backend/api/orders_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def remove_all(self, request):
if request.session.get("coupon_id"):
del request.session["coupon_id"]
shopping_cart.clear()
logger.info(SHOP_CART_CLEAR_MESSAGE)
logger.info("The shopping cart is empty, all the products inside are removed.")
payload = {"message": SHOP_CART_CLEAR_MESSAGE}
return Response(
ShoppingCartRemoveAllSerializer(payload).data, status=status.HTTP_200_OK
Expand Down Expand Up @@ -247,7 +247,7 @@ def list(self, request, **kwargs):
coupon, total_price_without_coupon
),
}
logger.info("The user's shopping cart list was successfully received.")
logger.info("The user's shopping cart was successfully received.")
return Response(serializer(payload).data, status=status.HTTP_200_OK)

def create(self, request, **kwargs):
Expand All @@ -274,7 +274,9 @@ def create(self, request, **kwargs):
coupon, total_price_without_coupon
),
}
logger.info("The shopping cart was successfully created.")
logger.info(
"A product was added to the shopping cart or its quantity was changed."
)
return Response(
ShoppingCartListSerializer(payload).data,
status=status.HTTP_201_CREATED,
Expand Down Expand Up @@ -329,7 +331,7 @@ def destroy(self, request, **kwargs):
coupon, total_price_without_coupon
),
}
logger.info(MESSAGE_ON_DELETE)
logger.info("A product was successfully removed from the shopping cart.")
return Response(
ShoppingCartListSerializer(payload).data,
status=status.HTTP_200_OK,
Expand Down Expand Up @@ -637,7 +639,7 @@ def destroy(self, request, *args, **kwargs):
serializer_data = response_serializer(order).data
serializer_data["Success"] = MESSAGE_ON_DELETE
order.delete()
logger.info(MESSAGE_ON_DELETE)
logger.info("The order was successfully deleted.")
return Response(serializer_data, status=status.HTTP_200_OK)

# TODO: test this endpoint
Expand Down
8 changes: 8 additions & 0 deletions infra/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ services:
- ./.env

frontend:
# Settings for building image from a cloned frontend repository (mind the branch)
build:
context: ../../frontend/
args:
- VITE_API_URL=${VITE_API_URL}
- VITE_BASE_URL=${VITE_BASE_URL}
# if we need a specific image name after building
# or want to pull a specific image from DockerHub (in this case comment lines 28-32)
image: healthyfoodapi/good_food_frontend:v.01
container_name: good_food_frontend
command: cp -r /app/dist/. /frontend_static/
Expand Down

0 comments on commit b7705db

Please sign in to comment.