-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imported templates are being cached for too long #253
Comments
We're running into this as well. (I almost didn't find this bug because you didn't use the term It looks like this would be quite tricky to fix; ideally you'd want the It might be implementable at a higher level (e.g. in |
I just ran into this as well. This is pretty annoying in development because it means that I have to set I'll try to dig in the internals to see if I come up with something. In the meantime, if someone with more experience could suggest with a solution or even some direction that would be really great! |
The problem is that imports are cached but not tracked. I'm not sure sure what the best way to deal with this would be. |
Ok, so the problem here isn't with the caching of the template but the caching of variables passed into the imported macros. My workaround was to use a method that returns my updated context values to be rendered. In my scenario I was making a macro for pagination. The macro needed the request object. initial approach within the macro working approach within the macro I also noticed that caching the macros has an ~2.5 x speed up in my response times. |
For those who stumble upon this issue, including my future self: I included |
I have a template called main.html. It {% imports %} a module called module_a (without context). module_a {% imports %} module_b in the same way.
When I change module_a, the template loader recognizes this and reloads it.
When I change module_b, the template loader does not recognize it. I have to restart the process.
I believe this is due to the fact that the generated code for module_a does the imports in its root() function. get_template sees that module_a is up to date, so does not reload it, so does not rerun its root() function.
I'm not sure how to address this. Obviously calling root() on each call to get_template is bad. The fullest solution would be to keep track of each template's dependencies, but that's a lot of work.
The text was updated successfully, but these errors were encountered: