Skip to content

happyweijie/NUSProfs

Repository files navigation

NUSProfs Backend

CI Python Django Django REST Framework PostgreSQL Redis Render

REST API backend for NUSProfs, a platform where NUS students can search for professors, view aggregated ratings, and share reviews of their teaching. The live API is hosted at nusprofs-api.onrender.com.

Features

  • Professor search & profiles — search professors by name, view their details, modules taught, and aggregated review ratings
  • Top professors — ranked listing of the highest-rated professors
  • Module comparison — compare professors teaching the same module, filterable by academic year
  • Reviews & replies — post, edit, and delete reviews with threaded replies and likes
  • JWT authentication — registration, login, token refresh/verification, and logout with refresh-token blacklisting

Tech Stack

  • Framework: Django 5.2 with Django REST Framework
  • Authentication: SimpleJWT (access + refresh tokens with blacklist)
  • Database: PostgreSQL
  • Caching: Redis via django-redis
  • Static files: WhiteNoise
  • Deployment: Gunicorn on Render

Getting Started

Prerequisites

  • Python 3.11+
  • PostgreSQL
  • Redis (optional, for caching)

Setup

  1. Clone the repository and create a virtual environment:

    git clone https://github.com/happyweijie/NUSProfs.git
    cd NUSProfs
    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure environment variables by copying the template:

    cp .env.example .env

    Generate a SECRET_KEY with:

    python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

    Then fill in the DEV_DB_* variables with your local PostgreSQL credentials (and REDIS_* if using caching).

  4. Apply migrations and (optionally) load seed data:

    python manage.py migrate
    python manage.py loaddata data/seed_data.json
  5. Start the development server:

    python manage.py runserver

    The server runs with development settings (NUSProfs.settings.dev) by default.

Running Tests

Tests run against a separate PostgreSQL database configured via the TEST_DB_* variables in .env (CI defaults: testdb / testuser / testpassword on localhost:5432).

DJANGO_SETTINGS_MODULE=NUSProfs.settings.test python manage.py test

Tests also run automatically on GitHub Actions for every push and pull request to main.

About

Backend for NUSProfs, a web-app enabling students to easily look up information about professors and view student feedback.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors