forked from ben-graves-method/method-pfc-bb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·53 lines (41 loc) · 1.11 KB
/
run.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
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Get project root, assumes this script is in project root
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Source virtual environment
source $PROJECT_ROOT/venv/bin/activate
# Only if we are on linux, we run a light weight web server to vend images
if [[ "$OSTYPE" == "linux"* ]]; then
sudo pkill busybox
sudo busybox httpd -p 8088 -h $PROJECT_ROOT/data/images/
fi
# Initialize command line arg default values
NO_DEVICE="false"
SIMULATE="false"
# Get command line arguments
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--no-device) shift
NO_DEVICE="true"
;;
--simulate) shift
SIMULATE="true"
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}"
# Export command line arguments
export NO_DEVICE
export SIMULATE
cd data/images
# serve images
python3.6 -m http.server 3001 2> /dev/null &
cd ../..
# Run app
python3.6 manage.py runserver 0.0.0.0:8000