Skip to content
Snippets Groups Projects
Commit 94345154 authored by Lars Kruse's avatar Lars Kruse
Browse files

refactor(run.sh): unify calling of python

* `/usr/bin/env` is not necessary: `python3` is just the same
  (`/usr/bin/env python3` is helpful in a shebang, since an absolute
  path is required there)
* use the variable `$PYTHON_EXEC`: it was introduced recently, but not
  used for now
parent 27fba39f
No related branches found
No related tags found
1 merge request!1Style & Tests
......@@ -34,7 +34,7 @@ echo "[ Docker=$docker ]"
# Check for the correct Python version (3.8+)
PYTHON_EXEC="python3"
echo "[ Using $(python3 -V) ]"
echo "[ Using $("$PYTHON_EXEC" -V) ]"
# +++ DEFAULT COMMANDS +++ #
......@@ -45,24 +45,24 @@ if [[ $docker == "false" ]]; then
if [[ $mode == "dev" ]]; then
source python/bin/activate
echo "Running Engine API in Python Environment ($(python3 -V))"
echo "Running Engine API in Python Environment ($("$PYTHON_EXEC" -V))"
echo "Starting API Server"
python src/app.py
"$PYTHON_EXEC" src/app.py
fi
### Runs the API Server (Test) ###
if [[ $mode == "api-test-0" ]]; then
echo "Starting API Server 0"
/usr/bin/env python3 src/app.py config=tests/config/engine-0-api.ini
"$PYTHON_EXEC" src/app.py config=tests/config/engine-0-api.ini
fi
if [[ $mode == "api-test-1" ]]; then
echo "Starting API Server 1"
/usr/bin/env python3 src/app.py config=tests/config/engine-1-api.ini
"$PYTHON_EXEC" src/app.py config=tests/config/engine-1-api.ini
fi
if [[ $mode == "api-test-2" ]]; then
echo "Starting API Server 2"
/usr/bin/env python3 src/app.py config=tests/config/engine-2-api.ini
"$PYTHON_EXEC" src/app.py config=tests/config/engine-2-api.ini
fi
### Runs the API Server using Gunicorn without a system daemon (Production) ###
......@@ -80,7 +80,7 @@ if [[ $docker == "false" ]]; then
### CAUTION: This deletes everything in your database ###
if [[ $mode == "recreate-database" ]]; then
/usr/bin/env python3 src/app.py --recreate-database
"$PYTHON_EXEC" src/app.py --recreate-database
fi
fi
......@@ -117,4 +117,4 @@ if [[ $docker == "true" ]]; then
if [[ $mode == "push" ]]; then
exec sudo docker push autoradio/engine-api
fi
fi
\ No newline at end of file
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment