Fully functional Django app giving a warning on deploy

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:

I’ve got this app set up just like another apps I have running on Fly that don’t have that warning. I’ve been pouring over this forum, but I haven’t found anything to help me fix this yet. I even tried destroying and re-launching the app. Same warning.

Relevant(?) parts of fly.toml:

  PORT = "8000"

  source = "storage"
  destination = "/mnt/storage"

  internal_port = 8000
  force_https = true
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 0

  guest_path = "/code/static"
  url_prefix = "/static/"

and Dockerfile:

FROM python:3.11.3


RUN mkdir -p /code


# install Git and Node
RUN apt-get update && \
    apt-get install -y git && \
    apt-get remove nodejs npm && \
    apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_18.x | bash && \
    apt-get install -y nodejs

COPY requirements/requirements.txt /tmp/requirements.txt

RUN set -ex && \
    pip install --upgrade pip && \
    pip install -r /tmp/requirements.txt && \
    rm -rf /root/.cache/

COPY . /code/


CMD ["/bin/bash", "-c", "npm i; npm run build; python manage.py collectstatic --noinput; python manage.py migrate --noinput; gunicorn --bind :8000 --workers 2 config.wsgi"]

You could try changing this to gunicorn --bind [::] :8000 or gunicorn --bind

If the warning still continues but your app works fine then possibly there is a bug in the code that generates the warning.

Good ideas, but neither worked. :upside_down_face: Really odd that there would be a bug that only effects one app of my several running on Fly, but I’m not ruling it out!

I’m guessing it’s some sort of race condition. I moved the npm i and npm build outside of the Docker CMD and I’m no longer getting the warning.

# …


RUN npm i && npm run build

CMD [ (same stuff minus that npm stuff) ]

I guess the Fly monitoring wasn’t picking up that it was listening to that port yet since it was still running build stuff?

Anyway, let me know if I’m way off here, but I’m happy for now!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.