Docker Community Forums

Share and learn in the Docker community.

Django web service - Inability to refresh changes

Webservice consists of containers: django, migrations,mysql.
Previously worked before, ie displayed landing page but now docker logs f4078a271808 shows status stuck at

Watching for file changes with StatReloader

When accessing http://127.0.0.1:8000/ on Chrome msg is:

127.0.0.1 didn’t send any data.
ERR_EMPTY_RESPONSE

Connections to containers seem fine, was able to successfully start/restart.

docker ps:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4078a271808 sanity-web:latest “python manage.py ru…” 46 hours ago Up 18 minutes 0.0.0.0:8000->8000/tcp sanity-web_django_1
cf69382509c6 sanity-web:latest “bash -c 'python man…” 46 hours ago Exited (1) 21 minutes ago sanity-web_migration_1
e88ba5590b10 sanity-db:latest “docker-entrypoint.s…” 46 hours ago Up 20 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp sanity-web_mysql_1

=====================================================================================

docker-compose.yml:
version: “3.1”
services:
mysql:
image: sanity-db:latest
restart: always
ports:
- “3306:3306”

django:
image: sanity-web:latest
restart: always
ports:
- “8000:8000”
depends_on:
- mysql
- migration
volumes:
- ./:/usr/src/app

migration:
image: sanity-web:latest
depends_on:
- mysql
volumes:
- ./:/usr/src/app
command: >
bash -c “python manage.py makemigrations --noinput &&
python manage.py migrate --noinput &&
python manage.py collectstatic --noinput”%

=====================================================================================

Dockerfile

FROM python:3.6

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
COPY manage.py /usr/src/app

RUN apt-get update && apt-get install -y
gcc
gettext
mysql-client default-libmysqlclient-dev
postgresql-client libpq-dev
sqlite3
–no-install-recommends && rm -rf /var/lib/apt/lists/*

EXPOSE 8000

CMD [“python”, “manage.py”, “runserver”, “0.0.0.0:8000”]%