From: Guillaume Pellerin Date: Mon, 9 Mar 2015 11:31:40 +0000 (+0100) Subject: Add a watchdog to sandbox for auto static collecting on CSS or JS file changes X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=729995ee1bab533be73b71d9b2edf0037664e3d9;p=timeside.git Add a watchdog to sandbox for auto static collecting on CSS or JS file changes --- diff --git a/examples/deploy/start_app.sh b/examples/deploy/start_app.sh index 82124d0..10db902 100644 --- a/examples/deploy/start_app.sh +++ b/examples/deploy/start_app.sh @@ -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