25 lines
615 B
Bash
Executable File
25 lines
615 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
|
|
if ! "$SCRIPT_DIR/init"; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! pip3 -V | grep -E "$SCRIPT_DIR/\.?venv"; then
|
|
echo "Entering virtual environment..."
|
|
source "$SCRIPT_DIR/.venv/bin/activate"
|
|
fi
|
|
|
|
if [[ "$1" == "prod" ]]; then
|
|
echo "Starting gunicorn production server..."
|
|
gunicorn -b 0.0.0.0:80 -b 0.0.0.0:443 "undercover:create_app()"
|
|
else
|
|
echo "Starting local dev server..."
|
|
export FLASK_ENV=development
|
|
export FLASK_APP=undercover
|
|
flask run --host=0.0.0.0
|
|
fi
|