This document provides guidance on setting up a Grove development environment on a local workstation.
Note: See docs/DevelopmentEnvironmentVsCode.md. for setting up a development environment using a VS Code Dev container.
-
Python 3.11
-
Install
libxmlsec1. This is required for the SAML authentication using djangosaml2.On Mac, it is available via Homebrew:
brew install xmlsec1
On Debian or Ubuntu Linux, it is available via
apt:sudo apt-get install xmlsec1
-
Update the
/etc/hostsfile to add:127.0.0.1 grove-local
-
Clone Grove from GitHub:
git clone git@github.com:umd-lib/grove cd grove -
Set up the Python virtual environment, and install the dependencies
python -m venv --prompt "grove-py$(cat .python-version)" .venv source .venv/bin/activate pip install -e .
-
Download the
grove-test-lib-umd-edu-sp.keyandgrove-test-lib-umd-edu-sp.crtfiles from the "grove-local-saml" entry in LastPass into the "grove" directory.ℹ️ Note: These files can be placed in an directory outside the project, if desired. Also, when downloading the
grove-test-lib-umd-edu-sp.crtfile, Google Chrome will modify the file extension, by default, to ".cer". Be sure to to specify the ".crt" extension when downloading the file. Mozilla Firefox preserves the ".crt" extension. -
Copy the "env_example" file to ".env":
cp env_example .env
and update the following variables with the appropriate values:
- SAML_KEY_FILE - relative (or absolute) file path to the
grove-test-lib-umd-edu-sp.keyfile - SAML_CERT_FILE - relative (or absolute) file path to the ``grove-test-lib-umd-edu-sp.crt` file
- SECRET_KEY - Either comment out (a random key will be automatically
generated), or populate with anything with sufficient randomness,
i.e.
uuidgen | shasum -a 256 | cut -c-64 - XMLSEC1_PATH - The full file path to the "xmlsec1" binary, (usually
findable by running
which xmlsec1)
- SAML_KEY_FILE - relative (or absolute) file path to the
-
Initialize the database:
./src/manage.py migrate
-
Load the default set of predicates:
./src/manage.py load_predicates -f predicate.csv
-
Run the application. The default port is 15001; this is also the port that is registered with DIT to allow SAML authentication to work from local:
./src/manage.py runserver
The application will be running at http://grove-local:15001/
To change the port, provide an argument to
runserver, e.g.:./src/manage.py runserver 5555
To install test dependencies, install the test extra:
pip install -e '.[test]'This project uses pytest in conjunction with the pytest-django plugin to run its tests. To run the test suite:
pytestTo run with coverage information:
pytest --cov src --cov-report term-missing