Open SmithChart opened 1 year ago
Hi @SmithChart,
Thanks for this bug-report. I think the cleanest and most extensible way to handle this would be to have a Lona setting named LIVE_RELOAD_IGNORE
or so. I will have to change the server setup code to have the settings available at such an early stage though.
Another way would be a .lonaignore
file like docker has, but if possible I would want to keep the Lona settings as the central place for all configuration.
Hi @fscherf,
I had skimmed though the commit introducing live reloading and I concluded that settings would not be available there. To be honest: I think to have this in the settings would be the best way to solve this. This would keep all settings in one place.
Another idea would be to use .gitignore
-files present in working directory. Usually files with state should be ignored there, too.
Hi @SmithChart,
I played around with some solutions, but the more I think about this, the more I think it is not an actual bug. --live-reload
waits for changes in the Lona project root, which always was about holding code, not data. Would you be ok with me just adding a line to the documentation stating something like "--live-reload
waits for changes in you project root. Don't put your data there to avoid loops and weird behavior"?
Hey @fscherf, thanks for working on this. I guess you are right. Data for the project should not reside where the code is. Having it all in one directory is simply due to me being lazy.
Adding a note to the documentation may make it a little more clear how it should be done. But it would probably be fine without this.
Well, I've tested
--live-reload
on my current project. And I think I mostly like this feature :-) It mostly works as expected.But: I am using a sqlite3 database (with the Django ORM). This means every change made to the database will lead to an updated file inside my project repository. And this leads to Lona reloading. Looking at the implementation it's totally clear why this happens.
But I think we could exclude a few extensions from the watch without loosing anything.
watchfiles
has filters in place: https://watchfiles.helpmanual.io/api/filters/#watchfiles.filters.DefaultFilter.ignore_entity_patterns I would suggest to add aDefaultFilter
towatchfiles.run_process()
. And to add at least.sqlite3
to theignore_entity_patterns
list. If we keep our extensions to the filter list at a central place we could event update this list if new extensions come along that we do not want to watch.What do you think about this?