From fb50140762983ab031570609be29da1ab401a653 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Wed, 16 Mar 2022 18:58:27 +0100 Subject: [PATCH] Add script and configure environment to install python dependencies into a project subfolder --- .gitignore | 1 + docs/Setup.md | 4 ++-- install-pip-dependencies.sh | 7 +++++++ lib/bootstrap.py | 2 +- lib/env.sh | 1 + packages/.gitkeep | 0 6 files changed, 12 insertions(+), 3 deletions(-) create mode 100755 install-pip-dependencies.sh create mode 100644 packages/.gitkeep diff --git a/.gitignore b/.gitignore index b1c2a32..8db7fca 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /application/**/migrations/* /archive/* /logs/* +/packages/* /temp /tmp __pycache__ diff --git a/docs/Setup.md b/docs/Setup.md index 2d3907d..4ddab18 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -20,9 +20,9 @@ Before the actual setup, you have to satisfy the following dependencies: All required python packages are listed `in pip-dependencies.txt` -You can install the required python packages with the following command: +You can install the required python packages with ```bash -pip install -U -r pip-dependencies.txt +./install-pip-dependencies.sh ``` ## II.A Installation diff --git a/install-pip-dependencies.sh b/install-pip-dependencies.sh new file mode 100755 index 0000000..8dfc0d2 --- /dev/null +++ b/install-pip-dependencies.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# install the required python packages + +wd=$(dirname $0) + +pip3 install -r "$wd/pip-dependencies.txt" -t "$wd/packages" diff --git a/lib/bootstrap.py b/lib/bootstrap.py index 7fc3286..84944b1 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -75,7 +75,7 @@ try: ) app_process = Popen( [ - "uvicorn", + "python3", "-m", "uvicorn", "--host", "localhost", "--port", quote(DJANGO_PORT), "drinks_manager.asgi:application" diff --git a/lib/env.sh b/lib/env.sh index 07a2b66..51181e9 100644 --- a/lib/env.sh +++ b/lib/env.sh @@ -3,3 +3,4 @@ export DJANGO_SK_ABS_FP="$(pwd)/config/secret_key.txt" export STATIC_FILES="$(pwd)/static/" export APP_VERSION="2.6" +export PYTHONPATH="$(pwd)/packages/" diff --git a/packages/.gitkeep b/packages/.gitkeep new file mode 100644 index 0000000..e69de29