2021-07-28 22:52:37 -04:00
|
|
|
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
|
2021-07-28 23:25:29 -04:00
|
|
|
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
|
2022-09-22 16:11:26 -04:00
|
|
|
if ! "$SCRIPT_DIR/init"; then
|
2021-07-28 23:25:29 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-07-28 23:41:07 -04:00
|
|
|
if ! pip3 -V | grep "$SCRIPT_DIR/.venv"; then
|
2021-07-28 22:52:37 -04:00
|
|
|
echo "Entering virtual environment..."
|
2022-09-22 16:11:26 -04:00
|
|
|
source "$SCRIPT_DIR/.venv/bin/activate"
|
2021-07-28 22:52:37 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$1" == "prod" ]]; then
|
|
|
|
echo "Starting gunicorn production server..."
|
2022-09-22 11:05:17 -04:00
|
|
|
gunicorn -b 0.0.0.0:443 "flaskr:create_app()"
|
2021-07-28 22:52:37 -04:00
|
|
|
else
|
|
|
|
echo "Starting local dev server..."
|
|
|
|
export FLASK_ENV=development
|
|
|
|
export FLASK_APP=flaskr
|
|
|
|
flask run --host=0.0.0.0
|
|
|
|
fi
|