Skip to content

pascalmolin/pasquiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QCM app

Simple Quizz application, one single python file.

v0.1: proof of concept

example

http://pascalmolin.pythonanywhere.com

usage

$ python app.py server --allow-register

launches a webserver on localhost:5000, with a valid link to generate token.

$ python app.py server --help

Usage: app.py server [OPTIONS]

Options:
--debug                        turn on Flask debug mode
--verbose                      log requests
--allow-register               provide registration link at index page
--number_questions INTEGER     number of questions per quizz
--number_choices INTEGER       number of choices per question
--secret_key TEXT              secret key
--token_method [none|default]  token method
--lang [en|fr]                 language
--port INTEGER                 http port
--help                         Show this message and exit.

requirements

flask
itsdangerous
pyqrcode
click

how it works

  • for each user an assignment is generated from a list of possible questions. The anwsers are stored.

  • all this is currently handled with a stupid database made of python lists and classes

  • each action (see question, answer it, validate...) must be allowed by a valid token, which contains a signed version of

    • quizz id
    • user id
    • question id
    • expiration time
  • a minimal flask setup makes this possible

questions files

one yaml file, structured as follows

---
text: This question is
choices:
- { text: "easy", correct: True }
- { text: "impossible" }
- { text: "red" }
tag: [stupid]

(may add fields id, title, image, hints... they are ignored)

todo

  • images,...
  • sql database

Troubleshooting

install on pythonanywhere

Install the required packages (pip install)

Edit app.py and hard-code your settings, and load the question file manually. For example:

quiz = QuizApp()
quiz.load_questions_yaml('example.yaml')

app = Flask('quiz')
app.config['lang'] = 'en'
app.config['verbose'] = True
app.config['SECRET_KEY'] = '<random>'
app.config['token_method'] = 'none'
app.config['number_questions'] = 8
app.config['number_choices'] = 3

no qrcode under wsgi

see unbit/uwsgi#1126 for python >= 3.6, configuration wsgi.ini needs option wsgi-disable-file-wrapper = true

About

tiny quiz app powered by flask

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published