docker stuck on django runserver

Viewed 724

Dockerfile:

FROM python:3.6-slim
ENV root=/test
ENV django=$root/test
COPY ./code $root
WORKDIR $django
RUN pip install -r requirements.txt --no-cache-dir
CMD ["python3",  "manage.py", "runserver", "--noreload"]

without --noreload it will stuck on

Watching for file changes with StatReloader

FYI, "docker run hello-world" is working fine.

FYI, running ubuntu on virtualbox on windows 10 home(as dev env)

UPDATE: I have changed the base image to

FROM python:3.6

and it works, but the question is still there why it is not working with slim?

1 Answers

What is your DEBUG value in settings? Can you change to False.

It's not related to docker image slip or any other image per say. Django is looking for hot-reload, whenever there is change in code, used for development purpose. But inside Docker it's not required as, I believe, you aren't changing your code.

Also use a wsgi/u for deployments - Gunicorn, uvicorn etc.

Related