Skip to content

Instantly share code, notes, and snippets.

@ninapavlich
Created March 15, 2018 01:53
Show Gist options
  • Save ninapavlich/6f90f4b38ed2eaf486466003d45a5032 to your computer and use it in GitHub Desktop.
Save ninapavlich/6f90f4b38ed2eaf486466003d45a5032 to your computer and use it in GitHub Desktop.
Manually deploy python project
#!/bin/sh
GIT_DIR="/srv/project-name/src/"
#First update the repo
git --git-dir=$GIT_DIR.git --work-tree=$GIT_DIR fetch
git --git-dir=$GIT_DIR.git --work-tree=$GIT_DIR reset --hard origin/master
echo "Pulled latest code from origin/master"
#Manage virtual environment
/srv/project-name/venv/bin/pip install -r /srv/project-name/src/requirements.txt
echo "Updated virtual environment"
#Update database
/srv/project-name/venv/bin/python /srv/project-name/src/manage.py migrate
echo "Migrated"
#Restart
sudo systemctl restart emperor.uwsgi
echo "Restarted emperor.uwsgi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment