meeb / django-distill

Minimal configuration static site generator for Django
MIT License
441 stars 35 forks source link

Is it possible that django-distill doesn't touch something which is not changed? #85

Closed kirmola closed 9 months ago

kirmola commented 9 months ago

pretty much it, can we just generate the pages which are changed and not touch anything which has been generated before?

meeb commented 9 months ago

This is more up to you really, you can selectively iterate the URLs to iterate in your distill_func however you like. For example, don't yield the URL if the output file already exists on disk. Alternatively you can writing single files calls:

https://github.com/meeb/django-distill?tab=readme-ov-file#writing-single-files

and handle generating your static pages manually one at a time yourself. There's no sensible way for django-distill itself to "detect" what generated HTML has changed other than to generate everything and check if they're different on disk which would defeat the point. Your application would know the logic of what has changed and what needs regeneration.

kirmola commented 9 months ago

Can I use database to generate pages?

meeb commented 9 months ago

I'm not entirely sure what you mean. Pretty much every Django project uses a database. If you mean database events, then yes check the link I pasted above which shows an example of how to use signals to generate single static pages on model save.

kirmola commented 9 months ago

Thanks for help. I got what you are talking about.