Skip to content

Instantly share code, notes, and snippets.

@doidor
Created October 16, 2015 09:07
Show Gist options
  • Save doidor/fbcfeeae114bf2606269 to your computer and use it in GitHub Desktop.
Save doidor/fbcfeeae114bf2606269 to your computer and use it in GitHub Desktop.
Django deploy script which works along with bundle.sh . It should be placed on the remote server.
#/bin/bash
TARGET_FOLDER='<target_folder_for_django_deployment>'
SYNCDB_COMMAND="$TARGET_FOLDER/<path_to_manage.py>"
# fetching the newest tar archive so we can deploy it
LATEST_TAR=`ls -t *.tar.gz | head -1`
echo "Cleaning up the target folder..."
rm -rf $TARGET_FOLDER"*"
echo "Extracting the latest build..."
tar -xzf $LATEST_TAR -C $TARGET_FOLDER
echo "Gracefully restarting the apache server..."
apachectl -k graceful
echo "Syncing the db..."
python $SYNCDB_COMMAND syncdb
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment