-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·31 lines (26 loc) · 851 Bytes
/
start.sh
File metadata and controls
executable file
·31 lines (26 loc) · 851 Bytes
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
#!/usr/bin/env bash
make rundb
export DEBUG=1
# Check if we have unapplied migrations
if python -W ignore manage.py showmigrations --plan | grep "\[ \]" -q; then
echo "Migrations found"
python -W ignore manage.py makemigrations
python -W ignore manage.py migrate
make start
else
echo "No pending migrations"
# Check that DB container is up and running
if ! [ -x "$(command -v nc)" ]; then
echo "netcat not on system."
echo "If django server fails to connect to db press Ctrl+C and run 'make start' again"
else
while ! nc -z localhost 5432; do
echo "Waiting for DB container to boot"
sleep 0.5 # wait for half a second
done
echo "Giving DB container time to initialize..."
sleep 1
fi
# Run dev server
python manage.py runserver
fi