carltongibson / django-template-partials

Reusable named inline partials for the Django Template Language.
MIT License
387 stars 15 forks source link

When i add "template_partials" app changes in html templates stop updating until I rerun the server #39

Closed AHTOOOXA closed 3 months ago

AHTOOOXA commented 3 months ago

When i connect the app templates just freeze and changes aren't being shown on the rendered pages until i restart the server.

Don't really understand yet what's going underneath in your package and is this little thing fixable but it's frustrating to restart the server every time i wanna see changes in html templates

carltongibson commented 3 months ago

Hi @AHTOOOXA — is this with the latest version 24.1?

We fixed a bug there where we weren't correctly proxying to Django's cached loader. As far as I can see the behaviour is now correct but some folks do report problems using the cached loader in development. (I've never been able to pin this down myself 100%).

You could try adopting the example from the README in the Advanced Configuration section to not use the cached loader.

Something like...


default_loaders = [
    "django.template.loaders.filesystem.Loader",
    "django.template.loaders.app_directories.Loader",
]
# Not using the cached_loader here. 
# Contrast with the README example.
partial_loaders = [("template_partials.loader.Loader", default_loaders)]

settings.TEMPLATES[...]['OPTIONS']['loaders'] = partial_loaders

Let me know if that helps.

Otherwise, try reverting to 23.4, and let me know how that goes.

corneliusabel commented 3 months ago

I had the same problem with 24.1. had to revert to 23.4 and it worked again.

carltongibson commented 3 months ago

Hi @AHTOOOXA @corneliusabel — could either of you give the branch in #40 a run, to see if that resolves your issue?

Thanks!

AHTOOOXA commented 3 months ago

thank you a lot for the fix sorry couldn't figure out how to try it... but 24.2 works perfectly

carltongibson commented 3 months ago

@AHTOOOXA Thanks for confirming. (Nice speedy pick up, I only just pushed it 😜)