Skip to content

Commit

Permalink
feat: Add django-db-geventpool dependency and enhance health check lo…
Browse files Browse the repository at this point in the history
…gging
  • Loading branch information
AhmedNassar7 committed Dec 18, 2024
1 parent eba2de6 commit cbd4430
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 956 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
echo "Starting deployment to Render..."
render deploy --service-name egypt-metro
render deploy --config render.yaml --service-name egypt-metro
echo "Deployment complete!"
4 changes: 4 additions & 0 deletions egypt_metro/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import logging
from django.http import JsonResponse
from django.db import connection

logger = logging.getLogger(__name__)


def health_check(request):
try:
connection.ensure_connection() # Check DB connection
return JsonResponse({"status": "ok"})
except Exception as e:
logger.error(f"Health check failed: {str(e)}")
return JsonResponse({"status": "error", "details": str(e)}, status=500)


Expand Down
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ whitenoise = "6.7.0" # WhiteNoise for serving static files in Django

# [tool.poetry.dev-dependencies]
# Development dependencies including testing and development tools.
django-db-geventpool = "^4.0.7"
[tool.poetry.dev-dependencies]
pytest = "^6.2.4" # Pytest for unit testing
pytest-asyncio = "^0.15.1" # Pytest plugin for asyncio tests
Expand Down
Loading

0 comments on commit cbd4430

Please sign in to comment.