From e71c9814a178994a8285bb0db6700342ed9fb258 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Wed, 28 Jul 2021 22:52:37 -0400 Subject: [PATCH] Add start file to automatically kick off server --- start | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 start diff --git a/start b/start new file mode 100755 index 0000000..38e6867 --- /dev/null +++ b/start @@ -0,0 +1,17 @@ +#!/bin/bash +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" + +if ! pip -V | grep "$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:6969 "flaskr:create_app()" +else + echo "Starting local dev server..." + export FLASK_ENV=development + export FLASK_APP=flaskr + flask run --host=0.0.0.0 +fi