I have this weird issue where not all file edits are being picked up by the hot reloader for Django.
I have this structure:
/
app/ ... apps in here.
config/settings.py
manage.py
Now, any changes to config/settings.py or manage.py will result in the django runserver reloading.
But any changes to files inside app/... don't trigger a reload - I have to go and add a newline to manage.py and save (quite irritating).
Any ideas why this might be?
At first I thought it was a docker thing, and it was only picking up files in the base dir, but then changes to config/settings.py also trigger the reload, so clearly it can see deeper.
EDIT: Addition info
Django 3.2, PyCharm, MacOS - yes, all apps are in INSTALLED_APPS
I have another project that has the EXACT same structure and for some reason it works... I'm really stumped.
EDIT adding dc and dockerfile
FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY ./requirements /requirements
ARG pip_requirement_file
RUN apt-get update && apt-get install -y libjpeg62-turbo-dev zlib1g-dev gcc ca-certificates gcc postgresql-client sed xmlsec1 pax-utils && apt-get clean
RUN pip install --no-cache-dir -r /requirements/$pip_requirement_file \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' +
# Copy requirements and install local one
RUN rm -rf /requirements
COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY ./compose/django/start-server.sh /start-server.sh
RUN sed -i 's/\r//' /start-server.sh
RUN chmod +x /start-server.sh
# Very specifically copy the files we want to avoid bloating the image.
COPY ./manage.py /app/
COPY ./app/ /app/app/
COPY ./admin_static/ /app/admin_static/
COPY ./config/ /app/config/
COPY ./database/ /app/database/
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/start-server.sh"]
docker compose
services:
django:
container_name: django
build:
context: .
dockerfile: ./compose/django/Dockerfile
args:
pip_requirement_file: local.txt
depends_on:
- postgres
ports:
- "8000:8000"
links:
- postgres:postgres
volumes:
- .:/app
env_file: .env