Skip to content

Instantly share code, notes, and snippets.

Last active May 12, 2020 09:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A script for helping update a Django ( site
if [[ "$EUID" = 0 ]]; then
echo "Do not run this script as root"
exit 0
sudo -k
if sudo true; then
sudo service apache2 stop
cd /var/www/
source venv/bin/activate 2>&1
cd django
GIT_BRANCH="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
git pull origin ${GIT_BRANCH} 2>&1
pip install -r requirements.txt 2>&1
python crazyfacts/ compilescss 2>&1
python crazyfacts/ collectstatic 2>&1
python crazyfacts/ makemigrations 2>&1
python crazyfacts/ migrate 2>&1
deactivate 2>&1
sudo service apache2 start 2>&1
exit 1
echo "Password incorrect. Script not executed"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment