Deploy Django - Failed: timeout reached waiting for machine's state to change

Good afternoon. I’m attempting to deploy a Django application, but when I run “flyctl deploy,” I encounter the following error: "timeout reached waiting for machine’s state to change. Your machine was created, but never started. This might suggest that your app is taking an extended time to initiate, though it could also be indicative of a region-related issue.

I’ve tried switching regions and extending the timeout, but the error persists. On the platform, the application is marked as suspended. Could someone kindly assist me? Thank you.

fly.toml

fly.toml app configuration file generated for vivenciarte-system on 2024-01-14T16:17:23-03:00

See Fly Launch configuration (fly.toml) · Fly Docs for information about how to use this file.

app = “vivenciarte-system”
primary_region = “gig”
console_command = “/code/manage.py shell”

[build]

[env]
PORT = “8000”

[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = [“app”]

[[vm]]
cpu_kind = “shared”
cpus = 1
memory_mb = 1024

[[statics]]
guest_path = “/code/static”
url_prefix = “/static/”

Dockerfile
ARG PYTHON_VERSION=3.10-slim-bullseye

FROM python:${PYTHON_VERSION}

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN mkdir -p /code

WORKDIR /code

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

EXPOSE 8000

CMD [“gunicorn”, “–bind”, “:8000”, “–workers”, “2”, “core.wsgi”]

Error (terminal):

:heavy_multiplication_x: Failed: timeout reached waiting for machine’s state to change

Error: timeout reached waiting for machine’s state to change
Your machine was created, but never started. This could mean that your app is taking a long time to start,
but it could be indicative of a region issue.

You can try deploying to a different region,
or you can try increasing the timeout with the --wait-timeout flag

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