Generate standalone assets

Possible In Django?

I have a project in django where there is a lot of processing involved to generate output. However output rarely changes like (once is couple of days)…

I have thousands of clients who visit site to stay updated on this data. Instead of running that cpu intensive calculation each time for each of them. I want to generate a standalone HTML, CSS, JS folder which shows Output as normally.

I would then host this on GitHub Pages/Netifly like service. And then I am planning to automatically update these HTML, JS, CSS everytime there is a change in some data.

Is this possible to generate those standalone HTML, CSS, JS assets in Django?

PS: Do let me know this is not the right place to ask this question, I will remove the post.

Yes it’s possible.

You can render your templates to a string and write those strings to files.

You can use cron or Celery Beat to run your updates on a scheduled basis, or run Celery tasks if this process needs to be started as a result of a view being called.

1 Like