A centralized website to connect RPI undergraduate students with research or lab positions
posted by professors, graduate students, or lab staff.
- Clone
- Clone repo through CLI
$ git clone https://github.com/LabConnect-RCOS/LabConnect-Backend.git
- or through Github Desktop
- Clone repo through CLI
- Install Python 3.12.4
- Mac
brew install python@3.14 - Windows: here
- Linux:
$ sudo apt install python3
- Mac
- Install PostgreSQL
- The application is built and tested with postgresql 17
- Mac: UI here or
brew install postgresql@17- Windows: here
- Linux:
$ sudo apt install postgresql
- Install Libraries
$ python3 -m pip install -r requirements.txt - Setup user and initialize database
-
Windows:
$ psql -U postgres -d postgres CREATE DATABASE labconnect; ALTER USER postgres WITH PASSWORD 'root'; \q
-
macOS (Homebrew):
# start postgres if not running $ brew services start postgresql $ psql -U postgres -d postgres CREATE DATABASE labconnect; ALTER USER postgres WITH PASSWORD 'root'; \q
-
macOS (Postgres.app):
# open Postgres.app, then in a terminal (Postgres.app adds psql to PATH) $ psql -d postgres CREATE DATABASE labconnect; ALTER USER postgres WITH PASSWORD 'root'; \q
-
Linux:
$ sudo -i -u postgres $ psql ALTER USER postgres WITH PASSWORD 'root'; \q $ exit $ sudo -u postgres createdb labconnect
-
Final step
- Run the db initialization with test/dummy data
make create
- Run the db initialization with test/dummy data
-
- Run pytest
- Run all the test files and generate a coverage report. Coverage reports are set up to output to the terminal and provide an HTML file that can be viewed to show what branches or statements are not covered. It is in the project's best interest to have high coverage to ensure all statements and branches work as expected.
or manually$ make testor manually with a coverage report generated$ python3 -m pytest
or individual tests$ python3 -m pytest --cov
$ python3 -m pytest -q tests/(file_name).py
- Run flask with python directly
- Run all the test files
or$ make develop
$ python run.py
Create PRs to the main branch. Upon merging, a new Docker container will be created and pushed to the packages for this repo.
Use the Docker container in the packages tab. You can set these environment variables:
| Variable Name | Default Value | Description |
|---|---|---|
SECRET_KEY |
main-secret |
Secret Key for Flask |
JWT_SECRET_KEY |
jwt-secret |
Secret Key for JWT |
FRONTEND_URL |
None | URL to the frontend server |
DB |
None | URI for postgres database eg. postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres/labconnect |
CONFIG |
config.TestingConfig |
URL to the backend server |
- Run gunicorn to test how the service runs in production
or with Makefile
$ make run
$ gunicorn run:app -w 6 --preload --max-requests-jitter 300 --bind 0.0.0.0:8000
Distributed under the Apache License. See LICENSE for more information.