Cannot reach Django Rest API with gunicorn + postgres + docker-compose [duplicate]

I am slowly trying to put together a production build for my API. However, I can’t seem to access it when I visit localhost:8000. How I am testing this is by first running $ docker-compose run postgres to have the database up and running. Then $ docker-compose run api for the API. Here is the output of running the API

Starting redribbon_postgres_1 ... done
[2020-02-13 00:57:38 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2020-02-13 00:57:38 +0000] [1] [INFO] Listening at: http://127.0.0.1:8000 (1)
[2020-02-13 00:57:38 +0000] [1] [INFO] Using worker: sync
[2020-02-13 00:57:38 +0000] [8] [INFO] Booting worker with pid: 8

However, when I visit localhost:8000, I am seeing Site cannot be reached. Not sure why this is the case. The only difference between my develop and production build is that I am not using gunicorn in my develop build.

docker-compose.yml

version: "3"
services:
  postgres:
    image: postgres:latest
    restart: always
    ports:
      - "5432:5432"
    volumes:
      - ./pgdata_prod:/var/lib/postgresql/data/
    environment:
      POSTGRES_DB: redribbon
      POSTGRES_USER: bli1
      POSTGRES_PASSWORD: password
  api:
    build:
      dockerfile: Dockerfile
      context: ./redribbon-api
    command: gunicorn --chdir api api.wsgi -b localhost:8000
    volumes:
      - ./redribbon-api/api:/usr/src/api
    depends_on:
      - postgres
    ports:
      - "8000:8000"

Source: StackOverflow