From 729995ee1bab533be73b71d9b2edf0037664e3d9 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 9 Mar 2015 12:31:40 +0100 Subject: [PATCH] Add a watchdog to sandbox for auto static collecting on CSS or JS file changes --- examples/deploy/start_app.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) 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 -- 2.39.5