Skip to main content

Custom TriviaFlow Commands

These commands are specific to the TriviaFlow project (found in the quiz app) and are designed to help with game configuration, testing, and management.

Game Configuration

init_game_config

docker exec -it triviaflow_app python manage.py init_game_config [options]

Purpose:
Initializes or updates the game configuration in the database based on the defaults defined in the code (and optionally game_config.ini). This serves as the source of truth for all game mechanics.

What it controls:

  • Scoring: Points per question, speed bonuses, multipliers.
  • Lobby: Timeouts, max active lobbies.
  • Game Modes: Auto vs Manual, delays between questions.

Useful Options:

  • --reset: Resets all settings to their default values, overriding any manual changes in the database.
  • --force: Forces an update even if values haven't changed.

When to use:

  • When deploying for the first time.
  • If you have manually disrupted the settings and want to restore defaults.
  • After updating the codebase if new configuration settings have been added.

init_presets

docker exec -it triviaflow_app python manage.py init_presets

Purpose:
Creates or updates the built-in game configuration presets. These are the "modes" available when creating a new game.

Included Modes:

  • 🏆 Competitive Mode: Fast-paced, time penalties, strict rules.
  • 🎮 Casual Mode: Relaxed, generous times, allow answer changes.
  • 📚 Educational Mode: Stepped scoring, longer times, focused on learning.

When to use:

  • After an update that changes the definitions of these presets.
  • If you accidentally deleted the standard presets and want to restore them.

Testing & Simulation

fake_players

docker exec -it triviaflow_app python manage.py fake_players <room_code> <count>

Purpose:
Adds fake "bot" players to a running game session.

Arguments:

  • <room_code>: The active game lobby code (e.g., ABCD).
  • <count>: Number of bots to add (e.g., 10).

Example:

docker exec -it triviaflow_app python manage.py fake_players ABCD 10

When to use:

  • Testing: To verify that the lobby works with many players.
  • Demoing: To show off the game mechanics without needing 10 real people to join.
  • Load Testing: To simulate a busy game environment.