I'm use flask-assets for bundling, minification and versioning (making sure that when we change a CSS or JS file, the browser loads the new version, instead of what's in its cache... but of course we want it to load from the cache subsequently).
Since the site only has a few pages and they all use different resources, I've defined the bundles in the templates themselves, as described under Templates Only in the docs:
{% assets filters="jsmin", output="gen/our-page_packed.js",
"blah.js", "yadda.js", "rhubarb.js", "wibble.js" %}
<script src="{{ ASSET_URL }}"></script>
{% endassets %}
{% assets filters="cssmin", output="gen/our-page_packed.css",
"css/foo.css", "css/bar.css" %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
ASSETS_DEBUG
is False in production, and the site is not localised, nor served through a CDN or with S3.
The problem is, when we push to production, the bundles initially apparently aren't being created. The pages lack CSS and Javascript, and the apache error log contains errors like this:
File does not exist: /srv/our-client/our-client/static/gen/our-page_packed.css, referer: https://app.our-client.com/quux/123/xyz/
After we reload the page a number of times, over the course of a minute or two, it all starts working. We occasionally hear customer complaints about what sounds like missing CSS or JS, but it doesn't seem to persist and it's not clear it's a related issue.
I'm afraid I'm far from a Flask expert (the site was created by another developer; I added flask-assets) but it seems a fairly straightforward setup. Is there something I can do to make sure the bundle files get created early?