-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·28 lines (23 loc) · 734 Bytes
/
run.sh
File metadata and controls
executable file
·28 lines (23 loc) · 734 Bytes
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
#!/bin/bash
set -e
if ! command -v python3 &>/dev/null; then
echo "Python3 is not installed. Please install Python3."
exit 1
fi
if [ ! -f secret.py ]; then
cp secret.py.example secret.py
echo "Please edit the secret.py file and add in your secrets."
exit 1
fi
export FLASK_APP=app
if [[ $1 == dev ]]; then
echo "Using Development environment"
export FLASK_ENV=development
flask run
elif [[ $1 == prod ]]; then
echo "Using production environment with nohup and gunicorn"
nohup gunicorn -w 4 -b 127.0.0.1:5000 app:app &
else
echo "!!! Using sudo production environment since argument was not provided. To use dev setup, use './run.sh dev'"
gunicorn -w 4 -b 127.0.0.1:5000 app:app
fi