From f648433e530902de984290cabd04a0f37ba8e23e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 5 Dec 2019 22:56:20 +1100 Subject: [PATCH 1/3] Add documentation for creating a virtual environment --- .gitignore | 4 ++++ docs/start.rst | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6b36e2d1d2..4c64eeae70 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,10 @@ env/ ./build/ develop-eggs/ dist/ +bin/ +lib64 +pyvenv.cfg +share/ downloads/ eggs/ .eggs/ diff --git a/docs/start.rst b/docs/start.rst index f45c3a8d14..344e49d067 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -22,6 +22,24 @@ To install InvenTree you will need the following system components installed: Each of these programs need to be installed (e.g. using apt or similar) before running the ``make install`` script. +Virtual Environment +------------------- + +Installing the required Python packages inside a virtual environment allows a local install separate to the system-wide Python installation. While not strictly necessary, using a virtual environment is highly recommended as it prevents conflicts between the different Python installations. + +To configure Inventree inside a virtual environment, ``cd`` into the inventree base directory and run the following commands: + +`` +apt-get install python3-venv +source inventree/bin/activate +`` + +This will place the current shell session inside a virtual environment - the terminal should display the ``(inventree)`` prefix. + +.. note:: + Remember to run ``source inventree/bin/activate`` when starting each shell session, before running Inventree commands. This will ensure that the correct environment is being used. + + Installation ------------ @@ -58,7 +76,7 @@ Once install settings are correctly configured (in *config.yaml*) run the initia ``make migrate`` -which performs the initial database migrations, creating the required tables, etc +This performs the initial database migrations, creating the required tables, etc. The database should now be installed! From 000229fcbb8beb956bcbf2813006358913b1926a Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 5 Dec 2019 23:05:28 +1100 Subject: [PATCH 2/3] Ignore venv files for PEP checking --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 61a1b69c6f..e56067f4ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,5 +6,5 @@ ignore = E501, E722, # - C901 - function is too complex C901, -exclude = .git,__pycache__,*/migrations/* +exclude = .git,__pycache__,*/migrations/*,*/lib/*,*/bin/* max-complexity = 20 From ef37eada2f46f9ff309c9b09619829d25ea847f1 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 5 Dec 2019 23:07:36 +1100 Subject: [PATCH 3/3] Tweak docs --- docs/start.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/start.rst b/docs/start.rst index 344e49d067..65fbf7b1ec 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -29,10 +29,9 @@ Installing the required Python packages inside a virtual environment allows a lo To configure Inventree inside a virtual environment, ``cd`` into the inventree base directory and run the following commands: -`` -apt-get install python3-venv -source inventree/bin/activate -`` +``apt-get install python3-venv`` + +``source inventree/bin/activate`` This will place the current shell session inside a virtual environment - the terminal should display the ``(inventree)`` prefix.