Skip to main content

Local Development Setup

If you want to modify the code or contribute to TriviaFlow, you should set up a local development environment.

The easiest way to develop is to use the existing Docker setup but override the settings for development.

  1. Clone the repo:

    git clone [https://github.com/your-user/triviaflow.git](https://github.com/your-user/triviaflow.git)
    cd triviaflow
  2. Configure .env: Copy .env.example to .env and set:

    DEBUG=True
    # Use 'redis' if running via docker, or 'localhost' if running natively
    REDIS_HOST=redis
  3. Run with Compose:

    docker compose up --build

Benefits:

  • The local folder is mounted into the container. Any change you make to .py files will trigger an auto-reload.
  • Database and Redis are pre-configured.

Option B: Native Python (Virtualenv)

If you prefer running Django directly on your machine.

Prerequisites

  • Python 3.11+
  • Redis Server (must be running locally)
  • MariaDB or SQLite (Default is MariaDB, but you can switch to SQLite in settings.py for dev)

Steps

  1. Create Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Set Environment Variables: Ensure your .env connects to your local Redis/DB, or modify settings.py to use sqlite3 and InMemoryChannelLayer if UseDocker is False.

  4. Run Migrations:

    python manage.py migrate
  5. Start Server:

    python manage.py runserver