2013-06-27 18:56:02 +02:00
|
|
|
#!/usr/bin/env python
|
2013-01-30 23:11:34 +01:00
|
|
|
|
|
|
|
# Update static files in production.
|
|
|
|
|
2013-06-27 18:56:02 +02:00
|
|
|
from os import chdir, path, open, close, O_WRONLY, O_CREAT
|
|
|
|
from glob import glob
|
|
|
|
import subprocess
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2013-06-27 18:56:02 +02:00
|
|
|
chdir(path.join(path.dirname(__file__), '..'))
|
|
|
|
|
|
|
|
# Redirect child processes' output to a log file (most recent run only)
|
|
|
|
close(1)
|
|
|
|
fp = open("update-prod-static.log", O_WRONLY|O_CREAT) # Will open on 1, stdout.
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2013-02-16 11:17:23 +01:00
|
|
|
# Compile Handlebars templates
|
2013-06-27 18:56:02 +02:00
|
|
|
subprocess.check_call(['tools/node', 'node_modules/.bin/handlebars']
|
|
|
|
+ glob('zephyr/static/templates/*.handlebars')
|
|
|
|
+ ['--output', 'zephyr/static/templates/compiled.js',
|
|
|
|
'--known', 'if,unless,each,with'])
|
2013-02-16 11:17:23 +01:00
|
|
|
|
2013-06-12 19:33:53 +02:00
|
|
|
# Collect the files that we're going to serve
|
2013-06-27 18:56:02 +02:00
|
|
|
subprocess.check_call(['rm', '-r', 'prod-static/source-map'])
|
|
|
|
subprocess.check_call(['mkdir', '-p', 'prod-static/source-map'])
|
|
|
|
subprocess.check_call(['python', './manage.py', 'collectstatic', '--noinput'])
|
2013-01-30 23:11:34 +01:00
|
|
|
|