From 4308a97beb346c41de19c1f6bacf3766959fff52 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Fri, 22 May 2015 14:00:57 +0200 Subject: [PATCH] Run django migrations during deploy --- .sti/bin/run | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.sti/bin/run b/.sti/bin/run index 38c9dd5..88a2c41 100755 --- a/.sti/bin/run +++ b/.sti/bin/run @@ -9,6 +9,19 @@ source .bashrc set -e + +# Support for Django + +# Take shallowest manage.py script +MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' -printf '%d\t%P\n' | sort -nk1 | cut -f2 | head -1) + +if pip show -q django && [ -f "$MANAGE_FILE" ]; then + set -x + python $MANAGE_FILE migrate --noinput + set +x +fi + + export APP_FILE=${APP_FILE:-"app.py"} if [[ ! -v APP_MODULE && -f setup.py ]]; then