-
Notifications
You must be signed in to change notification settings - Fork 2
Set Up
To run the code in this repo, you need Python 3.4 or greater installed correctly on your development workstation, as well as pip.
This Python repo uses the built in virtual environment, venv. To set up venv, go to the repo root directory and enter:
python -m venv ./venv
This command works on Windows, Mac and Linux (although you may need to substitute python3
for your platform, or use the backslash for Windows).
Depending on your platform, you'll need to activate your virtual environment.
In the repo root directory, enter these commands in PowerShell:
cd .\venv\Scripts\
.\Activate.ps1
Activate your venv with this bash command entered at the root of the project folder:
source ./venv/bin/activate
If you're using fish as your shell, you can activate venv like this:
set VIRTUAL_ENV "/home/neil/repos/oset/VersaEDM-Backend/venv"
Once venv is active, your command line should display (venv)
before the prompt. Then, use pip to install the required Python packages:
pip install -r requirements.txt
pip install -r requirements-dev.txt
This will ensure you've installed the correct versions of each package.
You'll also need to install docker.
We recommend using chocolately to install the most current version of the Docker Desktop package.
Install the latest docker using snap:
sudo snap install docker
Once you've installed the packages you need using venv, and have docker installed as well, you can run the app locally on port 8080 using the following Bash commands from the project root:
sudo docker build -t versa .
sudo docker run -it --rm --name versa-app -p 8080:8080 versa
Note that you can skip sudo
when running these commands in PowerShell on Windows 10.
Then you can run the browser app to consume the API endpoints defined in it. Currently only POST /party and GET /parties are defined.
To test the API, you can use curl:
curl http://localhost:8080/party
curl http://localhost:8080/parties
Storage is all in-memory at this point, nothing persisted to or read from disk/DB, so for the time being, you'll need to call POST methods to put data in before getting data out.