Open davepeck opened 7 months ago
There isn’t a method. Would this be when you run a management command or something? It could be an interesting addition.
Yes, this is in the context of a management command — in my case, one that's run while I'm also running a local dev server.
(My inelegant solution at the moment is to have the management command touch an otherwise unused reload.html
file sitting in my template hierarchy.)
This method would need to call trigger_reload_soon()
within the runserver
process. If you can figure out some way of doing lightweight cross-process communication to do that, it could work as an addition.
But then again, touching a file, as you’re already doing, is a simple cross-process communication method. So it might not be worth adding anything. FYI you can use Path.touch()
as a quick way to do this.
I pondered this over the weekend and eventually decided it probably isn't worth building an explicit mechanism when touching a file will do fine.
Not sure where you landed but if in the same place then maybe a documentation update to suggest this would be useful?
Other than that, we can probably close this issue. Thanks again...
Let's add a documentation section covering touching an existing template.
Description
For instance, I'd like to force a reload when I create or update a specific model instance in my app. Presumably, if
django_browser_reload
is inactive (DEBUG
isFalse
, etc.) then this is a no-op.Apologies if I simply missed it, but is there an explicitly supported method I can call (or signal I can raise) to achieve this?