forked from DemocracyClub/Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·38 lines (27 loc) · 842 Bytes
/
deploy.sh
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
38
#!/usr/bin/env bash
set -e
die () {
echo >&2 "$@"
exit 1
}
if [ $# -eq 0 ]
then
die "No env supplied. Call with ./deploy [dev|prod]"
fi
DEPLOY_ENV=$1
[ $DEPLOY_ENV == "dev" ] || [ $DEPLOY_ENV == "prod" ] || die "Env not valid. Must be dev or prod"
export STAGE=$1
echo "Performing Django checks"
FRAMEWORK="Zappa" python manage.py check
echo "Running collectstatic locally to check for errors"
FRAMEWORK="Zappa" python manage.py collectstatic --noinput
echo "Deploying to $DEPLOY_ENV"
# Set up paths needed for deploy
# See README for why we have to do this.
mkdir -p `echo $VIRTUAL_ENV `/lib/python3.6/site-packages/{pillow,libsass}
# Update Zappa
zappa update $DEPLOY_ENV
# Migrate the Django DB
zappa manage $DEPLOY_ENV "migrate --noinput"
# Collect static files
zappa manage $DEPLOY_ENV "collectstatic --noinput"