Reload gunicorn on CSS/JS changes.

assetcache hashes files on worker startup. We don't really mind a
worker reload on asset changes, since that's no worse than the old
setup with incrementing numbers. But to make this work smoothly,
we listen for changes to the CSS/JS dirs and reload on change.
remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-09-25 23:17:43 -04:00
parent 9d3c337eb3
commit 3739567b9d
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 13 additions and 0 deletions

View File

@ -28,3 +28,16 @@ def worker_abort(worker):
import os
os.abort()
def config_reload_extra_files():
import os
extra_files = []
asset_dirs = ['files/assets/css/', 'files/assets/js/']
for dir in asset_dirs:
fnames = os.listdir(dir)
paths = map(lambda x: dir + x, fnames)
extra_files.extend(paths)
return extra_files
reload_extra_files = config_reload_extra_files()