Skip to main content

Running the Server

How to run the server in a local environment.

Create the .env

A .env with AI keys and database credentials can be made available from any of the team members.

AI Keys Setup

The current version is using Google's Gemini AI. An API key can be generated here. In the .env file in the server directory copy the key following this format not including the brackets.

GEMINI_API_KEY=<YOUR KEY HERE>

Database Setup

The database that is in use is Supabase. In the dashboard for a created project under "Project Settings/Data API". From this dashboard copy the project url, anon/public key, and the service_role/secret key and place them in the .env file using this format without the brackets.

SUPABASE_URL=<YOUR KEY HERE>

SUPABASE_KEY=<YOUR KEY HERE>

SUPABASE_SERVICE_KEY=<YOUR KEY HERE>

Install the Dependencies

The server uses Python3 and the version we used was 3.12.0. Download Python Here. For dependency management our team uses a requirements.txt file and a virtual environment. Inside of the server folder

Create the virtual environment:

This must be activated to run the server.

Windows

py -m venv .venv

Mac/Linux

python3 -m venv .venv

Activate/Deactivate the virtual environment

Windows

.venv\Scripts\activate
deactivate

Mac/Linux

source .venv/bin/activate
deactivate

Install the dependencies

With the virtual environment active run

pip install -r requirements.txt

Running the program

flask --app app run --debug --port 8001 --host "0.0.0.0"

or without setting up the virtual environment the run.py file can be used to setup a virtual environment, install dependencies, run tests, create a coverage report, generate the documentation, and finally run the app all in one go.

Running Tests

From the webserver directory start the virtual environment and run

pytest tests/ -v

This will run all the tests in the tests directory. Adding more v's to the arguments adds additional verbosity to the output.