Is this the sole reason that you are bringing in the Django backend for a static site? I ask because Django seems like some serious overkill for this. I’m also interested in how others may try to accomplish this but I’ll give it a try. I use Ubuntu as my operating system so the answer will be tested for my OS. The steps should be similar but you may need to translate my solution to your OS.
The general idea of what I would do is have a model in Django that keeps track of template updates. It can be really simple.
name = models.CharField(max_length=50)
update_dt = models.CharField(max_length=50)
Next you need to decide an interval to poll your templates directory. I would run a cronjob on this interval.
You need a way to create a model object. You could create an API endpoint that updates the time of a given template object. Or do something like assuming you have the template name
manage.py shell --command="from path.to.app.models import TemplateUpdate;from django.utils import timezone;t=TemplateUpdate.objects.get(name=passed_name);t.update_dt=timezone.now();t.save();"
Basically you need to find a way to do the following:
1.) Get the modified date of a file. Ubuntu 16.04 ex.
stat path/to/file | grep "Modify"
2.) Update template object to reflect updated date via API or shell command as mentioned
3.) Combine the previous two scripts into a shell script for your OS
4.) Run the script on a set interval.
modified_dt = stat path/to/template.html | grep "Modify"
#api post request to update.. this part is on you
Now run this on a cronjob- this example is minutely
* * * * * /bin/sh /path/to/script.sh >> /dev/null
Now your Template object is being updated minutely. Pass the update_dt to the front end as a context variable and render it.
Considering my solution is already doing a lot with the system it may be easier to avoid bringing in Django dependencies and update the static file manually with the update date.