A script for helping update a Django (https://www.djangoproject.com/) site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$EUID" = 0 ]]; then | |
echo "Do not run this script as root" | |
exit 0 | |
else | |
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/manage.py compilescss 2>&1 | |
python crazyfacts/manage.py collectstatic 2>&1 | |
python crazyfacts/manage.py makemigrations 2>&1 | |
python crazyfacts/manage.py migrate 2>&1 | |
deactivate 2>&1 | |
sudo service apache2 start 2>&1 | |
exit 1 | |
else | |
echo "Password incorrect. Script not executed" | |
exit 0 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment