diff --git a/.gitignore b/.gitignore index d2876f81..189378da 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ scss/assets .pytest_cache/ .venv/ __pycache__ + +# Ignore static/fonts for now, since it is just symlink +static/fonts diff --git a/README.md b/README.md index 1a50ce22..de7f0cbe 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,17 @@ ./script/setup +The setup script will create a new Python virtual environment for the application to use. All of the scripts will activate this virutal envirnment automatically, but you can also manually activate it like this: + + source .venv/bin/activate + +If you want to automatically load the virtual environment whenever you enter the project directory, take a look at [direnv](https://direnv.net/) + ## Running (development) To start the app and watch for changes: - DEBUG=1 ./app.py + DEBUG=1 ./script/server ## Testing diff --git a/script/bootstrap b/script/bootstrap index b845e1ea..aee63a27 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -4,7 +4,10 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." + +# Activate virtual environment +source .venv/bin/activate # Install Python dependencies pip install -r requirements.txt diff --git a/script/server b/script/server index a7006aa9..ce8dd094 100755 --- a/script/server +++ b/script/server @@ -4,7 +4,10 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." + +# Activate virtual environment +source .venv/bin/activate # Launch the app -python3 app.py +python3 app.py ${@} diff --git a/script/setup b/script/setup index 19a8e225..ca645716 100755 --- a/script/setup +++ b/script/setup @@ -4,7 +4,7 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Install virtualenv pip install virtualenv diff --git a/script/test b/script/test index 29918052..9a910fa4 100755 --- a/script/test +++ b/script/test @@ -4,7 +4,10 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." + +# Activate virtual environment +source .venv/bin/activate # Run unit tests python3 -m pytest diff --git a/script/update b/script/update index d8d785f1..db23ee2d 100755 --- a/script/update +++ b/script/update @@ -4,7 +4,10 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." + +# Activate virtual environment +source .venv/bin/activate # Update dependencies script/bootstrap