]> git.parisson.com Git - timeside.git/commitdiff
Add a watchdog to sandbox for auto static collecting on CSS or JS file changes
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 9 Mar 2015 11:31:40 +0000 (12:31 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 9 Mar 2015 11:31:40 +0000 (12:31 +0100)
examples/deploy/start_app.sh

index 82124d07fc22b66e4aef997905f8d68cdb9aa6ae..10db902b5a6fab42837577f5618b4bcfec6bc957 100644 (file)
@@ -1,5 +1,22 @@
-python /opt/TimeSide/examples/sandbox/manage.py syncdb --noinput
-python /opt/TimeSide/examples/sandbox/manage.py migrate --noinput
-python /opt/TimeSide/examples/sandbox/manage.py collectstatic --noinput
+#!/bin/sh
 
-uwsgi --socket :8000 --wsgi-file /opt/TimeSide/examples/sandbox/wsgi.py  --chdir /opt/TimeSide/examples/sandbox/ --master --processes 4 --threads 2 --py-autoreload 3
\ No newline at end of file
+# paths
+app_dir='/opt/TimeSide/'
+sandbox_dir=$app_dir'examples/sandbox/'
+manage=$sandbox_dir'manage.py'
+wsgi=$sandbox_dir'wsgi.py'
+app_static_dir=$app_dir'timeside/player/static/'
+
+# django init
+python $manage syncdb --noinput
+python $manage migrate --noinput
+python $manage collectstatic --noinput
+
+# static files auto update
+pip install watchdog
+
+watchmedo shell-command --patterns="*.js;*.css" --recursive \
+    --command='python '$manage' collectstatic --noinput' $app_static_dir &
+
+# app start
+uwsgi --socket :8000 --wsgi-file $wsgi --chdir $sandbox_dir --master --processes 4 --threads 2 --py-autoreload 3