Skip to content

pythoncameroon/JUIN

Repository files navigation

Quizy

Turn study notes into practice quizzes. Students upload notes (PDF, DOCX, images, or pasted text); Gemini generates multiple-choice questions with a justification for every option (why each is right or wrong). Take graded quizzes and track progress.

Stack

  • Django 5.2 + HTMX
  • SQLite3
  • Google Gemini API (google-genai)
  • django-allauth (email and password)

Setup

uv sync
cp .env.example .env          # then set GEMINI_API
uv run python manage.py migrate
uv run python manage.py createsuperuser
uv run python manage.py runserver

Open http://127.0.0.1:8000, sign up, upload notes, and take a quiz.

How it works

  1. Upload notes on /documents/new. Text is extracted (PDF via pypdf, DOCX via python-docx, images sent directly to Gemini vision, text used as-is).
  2. Gemini generates questions using structured JSON output. Each choice carries a justification.
  3. Standard mode reveals explanations after each question. Exam mode reveals everything on the results page.
  4. The dashboard tracks sessions, best score, and answered count.

Configuration

See .env.example. Key settings: GEMINI_API, GEMINI_MODEL, GEMINI_MAX_CHARS (input truncation cap), MAX_UPLOAD_SIZE_MB.

Deploy to Coolify

The Dockerfile builds a single container (no docker compose). It collects static files at build time (served by WhiteNoise), runs migrations on boot, and serves via gunicorn on port 8000.

The database is dynamic: if POSTGRES_DB is set the app uses Postgres, otherwise it falls back to SQLite. In Coolify, attach a Postgres service and set the env vars below.

Steps

  1. Create a new resource from this Git repository. Coolify auto-detects the Dockerfile.
  2. Add a Postgres database resource and connect it to the app.
  3. Set the environment variables (below) on the app.
  4. Set the app port to 8000 and deploy.

Environment variables

Required:

  • SECRET_KEY long random string
  • DEBUG set to False
  • ALLOWED_HOSTS comma separated, e.g. abc.example.com
  • CSRF_TRUSTED_ORIGINS comma separated full origins, e.g. https://abc.example.com
  • GEMINI_API your Gemini API key

Postgres (Coolify injects most of these when you attach a Postgres service):

  • POSTGRES_DB
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_HOST the database service name/host
  • POSTGRES_PORT defaults to 5432

Optional:

  • MEDIA_ROOT mount a persistent volume here so uploads survive redeploys
  • WEB_CONCURRENCY gunicorn workers (default 3)
  • WEB_TIMEOUT gunicorn timeout seconds (default 120)
  • DB_CONN_MAX_AGE persistent DB connection seconds (default 60)

Create the first admin after deploy via Coolify's terminal:

python manage.py createsuperuser

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors