4

I'm trying to deploy a Django app in a Docker container.

It works well but the first time I open a page I receive these messages:

[CRITICAL] WORKER TIMEOUT
[INFO] Worker exiting
[INFO] Booting worker with pid: 19

The next time I open the same page it's pretty fast.

Here's my Dockerfile (generated by wagtail app starter)

FROM python:3.8.6-slim-buster

RUN useradd wagtail

EXPOSE 8000

ENV PYTHONUNBUFFERED=1 \
    PORT=8000

RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
    build-essential \
    libpq-dev \
    libmariadbclient-dev \
    libjpeg62-turbo-dev \
    zlib1g-dev \
    libwebp-dev \
    nano \
    vim \
 && rm -rf /var/lib/apt/lists/*

RUN pip install "gunicorn==20.0.4"

COPY requirements.txt /

RUN pip install -r /requirements.txt

WORKDIR /app

RUN chown wagtail:wagtail /app

COPY --chown=wagtail:wagtail . .

USER wagtail

RUN python manage.py collectstatic --noinput --clear

CMD set -xe; python manage.py migrate --noinput; gunicorn mysite.wsgi:application

How can I fix that?

Vincent Roye
  • 2,751
  • 7
  • 33
  • 53
  • 3
    I've implemented that Django + PostGres solution instead: https://docs.docker.com/samples/django/ and it is not happening anymore. – Vincent Roye Jul 01 '21 at 09:27

0 Answers0