-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·37 lines (30 loc) · 1.02 KB
/
deploy.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
SCRIPT_PATH=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SERVICE_NAME=$(basename $(dirname $SCRIPT_PATH)).service
function header()
{
echo
echo ------------------------------
echo $1
echo ------------------------------
}
source ../venv/bin/activate || exit $?
header "Versions"
echo -n "python: "
which python || exit $?
python --version || exit $?
echo -n "Django version: "
python -c "import django; print(django.__version__)"
header "Upgrading pip packages"
pip install -r requirements.txt || exit $?
echo "Django version is now: "
python -c "import django; print(django.__version__)" || exit $?
header "Migrating"
python manage.py migrate || exit $?
header "Collecting static"
python manage.py collectstatic --noinput || exit $?
header "Creating initial revisions (if any)"
python manage.py createinitialrevisions || exit $?
header "Restarting $SERVICE_NAME"
systemctl --no-pager --user restart $SERVICE_NAME || exit $?
systemctl --no-pager --user status $SERVICE_NAME || exit $?