This issue is pretty similar to: https://github.com/adamchainz/django-watchfiles/issues/2
I'm re-opening/duplicating the original issue with some additional context as I think some filtering is not properly taking effect here. I'm seeing the server restart/reload when anything in sqlite is touched (something which doesn't happen with the default StatReloader
)
Is this behaviour known + intended/expected? (If not I'm happy to investigate a bit further)
I guess I could easily move sqlite out of my project and into a separate dir (where it won't trigger reloads)
Below is a comparison between the default/watchfiles reloaders
https://user-images.githubusercontent.com/4996338/192100292-4799de5e-c667-4ce4-9fba-5f837ba3bdc3.mov
e.g. when I login to the admin panel:
❯ ./manage.py runserver
Watching for file changes with WatchfilesReloader
Performing system checks...
System check identified no issues (0 silenced).
September 24, 2022 - 13:04:54
Django version 4.1.1, using settings 'e.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
watcher: INotifyWatcher { channel: Sender { .. }, waker: Waker { inner: Waker { fd: File { fd: 7, path: "anon_inode:[eventfd]", read: true, write: true } } } }
raw-event: Event { kind: Create(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Access(Close(Write)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Remove(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Create(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Access(Close(Write)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Remove(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Create(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Modify(Data(Any)), paths: ["/home/jackevans/code/e/db.sqlite3"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Access(Close(Write)), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
raw-event: Event { kind: Remove(File), paths: ["/home/jackevans/code/e/db.sqlite3-journal"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
[24/Sep/2022 13:05:05] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
raw-event: Event { kind: Access(Close(Write)), paths: ["/home/jackevans/code/e/db.sqlite3"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
[24/Sep/2022 13:05:05] "GET /admin/ HTTP/1.1" 200 3888
raw-event: Event { kind: Access(Close(Write)), paths: ["/home/jackevans/code/e/db.sqlite3"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
/home/jackevans/code/e/db.sqlite3-journal changed, reloading.
Watching for file changes with WatchfilesReloader
Performing system checks...