adamchainz / django-watchfiles

Use watchfiles in Django’s autoreloader.
MIT License
83 stars 10 forks source link

Watchfiles watches files outside of django source root #83

Closed KIC closed 1 week ago

KIC commented 7 months ago

Python Version

3.11

Django Version

5.x

Package Version

0.1.0

Description

Watchfiles watches files outside of the django BASE_DIR i.e. in local docker volumes and fails with permission denied. PermissionError: Permission denied (os error 13) about

Warchfiles should only watch from BASE_DIR or allow some folders to be excluded via configuration.

adamchainz commented 7 months ago

django.BASE_DIR is not a reliable setting for “all the files in the project”. For example, TEMPLATES can be configured with paths outside of it.

django-watchfiles does nothing special with paths - it only tries to watch the paths that Django would watch anyway - python files, templates, etc. I would expect that if you see an error with watchfiles, you see it without (Django’s StatLoader), or at least with Django’s Watchman support. Can you check those options?

KIC commented 6 months ago

I would prefer a setting variable where we can exclude certain paths. much like https://github.com/adamchainz/django-watchfiles/issues/11

for now i sudo chmod 777 my docker volume. it works but it's nasty and I have to do this quite often.

adamchainz commented 6 months ago

You didn’t respond to my request about what happens with StatLoader or watchman.

I am not sure we should add any setting here, as the file paths to watch all come from Django.

adamchainz commented 1 week ago

Closing for now, unless we get any extra details.