Skip to content

Instantly share code, notes, and snippets.

@tom-henderson
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save tom-henderson/df2296e49d34eacfddb0 to your computer and use it in GitHub Desktop.

Select an option

Save tom-henderson/df2296e49d34eacfddb0 to your computer and use it in GitHub Desktop.
Django deploy script
#!/bin/bash
echo "Activating virtualenv"
source /home/django/.virtualenvs/my_app/bin/activate
source /home/django/.virtualenvs/my_app/bin/postactivate
which python
echo
echo "Fetching master branch"
cd /opt/my_app
git pull
echo
echo "Updating requirements"
pip install -r requirements/production.txt
echo
echo "Running migrations"
python manage.py migrate --noinput
echo
echo "Collect static files"
python manage.py collectstatic --noinput
echo
echo "Reloading apache"
sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment