Skip to content

Commit

Permalink
🎨 Format Python code with psf/black
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpeng02 committed Feb 7, 2024
1 parent 3b8eabc commit 5f04b42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions training/training/middleware/health_check_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
if request.path == '/health':
return HttpResponse('ok')
return self.get_response(request)
if request.path == "/health":
return HttpResponse("ok")
return self.get_response(request)
18 changes: 10 additions & 8 deletions training/training/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@

import requests, os

ALLOWED_HOSTS = ["backend-load-balancer-296304048.us-east-1.elb.amazonaws.com"]
ELB_HEALTHCHECK_HOSTNAMES = [
ip
for network in requests.get(os.environ["ECS_CONTAINER_METADATA_URI"]).json()[
"Networks"
ALLOWED_HOSTS = []
if "ECS_CONTAINER_METADATA_URI" in os.environ:
ELB_HEALTHCHECK_HOSTNAMES = [
ip
for network in requests.get(os.environ["ECS_CONTAINER_METADATA_URI"]).json()[
"Networks"
]
for ip in network["IPv4Addresses"]
]
for ip in network["IPv4Addresses"]
]
ALLOWED_HOSTS += ELB_HEALTHCHECK_HOSTNAMES
ALLOWED_HOSTS += ELB_HEALTHCHECK_HOSTNAMES
ALLOWED_HOSTS.append("backend-load-balancer-296304048.us-east-1.elb.amazonaws.com")

# Application definition

Expand Down

0 comments on commit 5f04b42

Please sign in to comment.