Skip to content
This repository was archived by the owner on Nov 14, 2020. It is now read-only.

removes FLASK_DEBUG, adds --reload #184

Merged
merged 7 commits into from
Nov 8, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
disables FLASK_DEBUG, enables reloading
dmalan authored and Kareem Zidane committed Nov 8, 2017

Verified

This commit was signed with the committer’s verified signature. The key has expired.
amondnet Minsu Lee
commit 7ad4e57ca60e41f8af85a20c31b7f3155bb94714
5 changes: 1 addition & 4 deletions files/etc/profile.d/ide50.sh
Original file line number Diff line number Diff line change
@@ -105,12 +105,9 @@ export DEBIAN_FRONTEND=noninteractive

# flask
export FLASK_APP="application.py"
export FLASK_DEBUG="1"

# flask wrapper
alias flask="/home/ubuntu/.cs50/bin/flask"

# http-server wrapper
# http-server
alias http-server="/home/ubuntu/.cs50/bin/http-server"

# language
5 changes: 4 additions & 1 deletion files/home/ubuntu/.cs50/bin/flask
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ if [[ "$1" == "run" ]]; then
# default options
host="--host=0.0.0.0"
port="--port=8080"
reload="--reload"
threads="--with-threads"
options=""

@@ -25,6 +26,8 @@ if [[ "$1" == "run" ]]; then
host="$1"
elif [[ "$1" =~ ^--port= ]]; then
port="$1"
elif [[ "$1" =~ ^--(no-)?reload$ ]]; then
reload="$1"
elif [[ "$1" =~ ^--with(out)?-threads$ ]]; then
threads="$1"
else
@@ -34,7 +37,7 @@ if [[ "$1" == "run" ]]; then
done

# spawn flask
script --flush --quiet --return /dev/null --command "FLASK_APP=\"$FLASK_APP\" FLASK_DEBUG=\"$FLASK_DEBUG\" flask run $host $port $threads $options" |
script --flush --quiet --return /dev/null --command "FLASK_APP=\"$FLASK_APP\" FLASK_DEBUG=\"$FLASK_DEBUG\" flask run $host $port $reload $threads $options" |
while IFS= read -r line
do
# rewrite address as hostname50