5 # default port : if hostname starts with z -> use 8080 ; otherwise take 80
6 hostname | grep -q '^z' && port=8080 || port=80
7 [[ -n "$@" ]] && port=$1
10 # we use make for convenience
11 # but what the static target really does is to invoke manage.py collectstatic
14 # if port is already used, we kill the server
15 pid=$(netstat -putan | awk "\$4 == \"0.0.0.0:$port\" && \$7 != \"-\" {split(\$7,a,\"/\"); print a[1]}")
16 [[ -n "$pid" ]] && kill $pid
18 ./manage.py runserver 0.0.0.0:$port