Giter VIP home page Giter VIP logo

quiz-game's Introduction

Quiz Game

Welcome to Quiz Game! This is a simple Flask web application where users can play a quiz game by answering multiple-choice questions.

Installation

  1. Clone the repository:
git clone https://github.com/1970Mr/quiz-game.git
cd quiz-game
  1. Set up a virtual environment (optional but recommended):
python -m venv venv
  1. Activate the virtual environment:
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
  1. Install the dependencies:
pip install -r requirements.txt

Configuration

Create a .env file in the root directory of the project and set the following environment variables. You can use the provided .env.example file as a template:

ADMIN_USERNAME=your_admin_username
ADMIN_EMAIL=your_admin_email
ADMIN_PASSWORD=your_admin_password
NUM_QUESTIONS_PER_STAGE=your_number_questions_per_stage

Usage

Seed Initial Data

You can seed initial data into the database, which includes creating the necessary tables and importing questions from a JSON file:

python initial_data.py path_to_json_file [--add-only]
  • path_to_json_file: The path to the JSON file containing the questions.
  • --add-only: Optional flag to add new questions without resetting the existing ones.

For example:

python initial_data.py data/questions.json

If you want to add questions to the existing ones without resetting:

python initial_data.py data/questions.json --add-only

Running the Application

After seeding the initial data or importing questions, you can run the Flask application:

flask run

Then, open your web browser and go to http://localhost:5000/ to access the Quiz Game.

Running with Docker Compose

You can also run the application using Docker and Docker Compose. This approach ensures that you don't need to manually set up a virtual environment or install dependencies locally.

Steps:

  1. Build and run the Docker container:

    docker-compose up --build
  2. After the container is up and running, open your web browser and go to http://localhost:5000/ to access the Quiz Game.

Credits

This project was created as a learning exercise by MR.1970. Feel free to contribute or use it as a basis for your own projects.

quiz-game's People

Contributors

1970mr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.