module cli.qcm_app
¶
Short summary¶
module mathenjeu.cli.qcm_app
Starts an app locally to test it.
Functions¶
function |
truncated documentation |
---|---|
Creates a https web-application with https authentification. |
|
Creates a local web-application with very simple authentification. |
Documentation¶
Starts an app locally to test it.
- mathenjeu.cli.qcm_app.create_qcm_https_app(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu', cookie_domain='127.0.0.1', cookie_path='/', title='Web Application MathEnJeu', short_title='MathEnJeu', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, display=None, games='simple_cinema_qcm, simple_cinema_qcm, 0;simple_french_qcm, simple_french_qcm, 0;ml_french_qcm, ml_french_qcm, 0', port=8868, middles=None, start=False, userpwd=None, debug=False, access_log='-', access_log_format='%(h)s %(r)s %(s)s %(b)s %(D)s', ca_certs=None, certfile=None, error_log='-', keep_alive=600, keyfile=None, root_path='', workers=1, reload=False, ciphers='ECDHE+AESGCM', fLOG=<built-in function print>)¶
Creates a https web-application with https authentification.
- Paramètres
secret_log – to encrypt log (None to ignore)
folder – folder where to write the logs (None to disable the logging)
max_age – cookie’s duration in seconds
cookie_key – to encrypt information in the cookie (cannot be None)
cookie_name – name of the session cookie
cookie_domain – cookie is valid for this path only, also defines the domain of the web app (its url)
cookie_path – path of the cookie once storeds
secure – use secured connection for cookies
title – title
short_title – short application title
page_doc – page documentation (default is “http://www.xavierdupre.fr/app/mathenjeu/helpsphinx”)
display – display such as
DisplayQuestionChoiceHTML
games – defines which games is available as a dictionary
{ game_id: (game name, first page id) }
orid,name,page;id,name,page
, id can be a filename.port – port to deploy the application
middles – middles ware, list of couple
[(class, **kwargs)]
where kwargs are the parameter constructorstart – starts the application with uvicorn
userpwd – users are authentified with any alias but a common password
debug – display debug information (starlette option)
access_log – The target location for the access log, use - for stdout.
access_log_format – The log format for the access log, see help docs, see Logging.
ca_certs – Path to the SSL CA certificate file.
certfile – Path to the SSL certificate file.
ciphers – Ciphers to use for the SSL setup, the default can be found at config.py
error_log – The target location for the error log, use - for stderr.
keep_alive – Seconds to keep inactive connections alive for.
keyfile – Path to the SSL key file
root_path – The setting for the ASGI root_path variable.
workers – The number of workers to spawn and use.
reload – Enable automatic reloads on code changes.
fLOG – logging function
- Renvoie
Creates a https web-application (Q&A) with authentification
The command line runs a web application meant to be local as there is not https involved. It implements a Q&Q. The web app relies on starlette, the server relies on hypercorn. Example:
python -m mathenjeu qcm_https
With that application, every user can login with a unique password abc.
<<<
python -m mathenjeu qcm_https --help
>>>
usage: qcm_https [-h] [-s SECRET_LOG] [-f FOLDER] [-m MAX_AGE] [-c COOKIE_KEY] [-co COOKIE_NAME] [-coo COOKIE_DOMAIN] [--cookie_path COOKIE_PATH] [-t TITLE] [-sh SHORT_TITLE] [-p PAGE_DOC] [-se SECURE] [-d DISPLAY] [-g GAMES] [-po PORT] [-mi MIDDLES] [-st START] [-u USERPWD] [-de DEBUG] [-a ACCESS_LOG] [-ac ACCESS_LOG_FORMAT] [-ca CA_CERTS] [-ce CERTFILE] [-e ERROR_LOG] [-k KEEP_ALIVE] [-ke KEYFILE] [-r ROOT_PATH] [-w WORKERS] [-re RELOAD] [-ci CIPHERS] Creates a https web-application with https authentification. optional arguments: -h, --help show this help message and exit -s SECRET_LOG, --secret_log SECRET_LOG to encrypt log (None to ignore) (default: ) -f FOLDER, --folder FOLDER folder where to write the logs (None to disable the logging) (default: .) -m MAX_AGE, --max_age MAX_AGE cookie's duration in seconds (default: 1209600) -c COOKIE_KEY, --cookie_key COOKIE_KEY to encrypt information in the cookie (cannot be None) (default: ) -co COOKIE_NAME, --cookie_name COOKIE_NAME name of the session cookie (default: mathenjeu) -coo COOKIE_DOMAIN, --cookie_domain COOKIE_DOMAIN cookie is valid for this path only, also defines the domain of the web app (its url) (default: 127.0.0.1) --cookie_path COOKIE_PATH path of the cookie once storeds (default: /) -t TITLE, --title TITLE title (default: Web Application MathEnJeu) -sh SHORT_TITLE, --short_title SHORT_TITLE short application title (default: MathEnJeu) -p PAGE_DOC, --page_doc PAGE_DOC page documentation (default is 'http://www.xavierdupre.fr/app/mathenjeu/helpsphinx') (default: http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/) -se SECURE, --secure SECURE use secured connection for cookies (default: False) -d DISPLAY, --display DISPLAY display such as :class:`DisplayQuestionChoiceHTML <mat henjeu.apps.display.html_display.DisplayQuestionChoice HTML>` (default: ) -g GAMES, --games GAMES defines which games is available as a dictionary ``{ game_id: (game name, first page id) }`` or ``id,name,page;id,name,page``, *id* can be a filename. (default: simple_cinema_qcm,simple_cinema_qcm,0;simple _french_qcm,simple_french_qcm,0;ml_french_qcm,ml_frenc h_qcm,0) -po PORT, --port PORT port to deploy the application (default: 8868) -mi MIDDLES, --middles MIDDLES middles ware, list of couple ``[(class, **kwargs)]`` where *kwargs* are the parameter constructor (default: ) -st START, --start START starts the application with `uvicorn` (default: False) -u USERPWD, --userpwd USERPWD users are authentified with any alias but a common password (default: ) -de DEBUG, --debug DEBUG display debug information (`starlette` option) (default: False) -a ACCESS_LOG, --access_log ACCESS_LOG The target location for the access log, use - for stdout. (default: -) -ac ACCESS_LOG_FORMAT, --access_log_format ACCESS_LOG_FORMAT The log format for the access log, see help docs, see Logging. (default: %(h)s %(r)s %(s)s %(b)s %(D)s) -ca CA_CERTS, --ca_certs CA_CERTS Path to the SSL CA certificate file. (default: ) -ce CERTFILE, --certfile CERTFILE Path to the SSL certificate file. (default: ) -e ERROR_LOG, --error_log ERROR_LOG The target location for the error log, use - for stderr. (default: -) -k KEEP_ALIVE, --keep_alive KEEP_ALIVE Seconds to keep inactive connections alive for. (default: 600) -ke KEYFILE, --keyfile KEYFILE Path to the SSL key file (default: ) -r ROOT_PATH, --root_path ROOT_PATH The setting for the ASGI root_path variable. (default: ) -w WORKERS, --workers WORKERS The number of workers to spawn and use. (default: 1) -re RELOAD, --reload RELOAD Enable automatic reloads on code changes. (default: False) -ci CIPHERS, --ciphers CIPHERS Ciphers to use for the SSL setup, the default can be found at config.py (default: ECDHE+AESGCM)
- mathenjeu.cli.qcm_app.create_qcm_local_app(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu', cookie_domain='127.0.0.1', cookie_path='/', title='Web Application MathEnJeu', short_title='MathEnJeu', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, display=None, fct_game=None, games='simple_cinema_qcm, simple_cinema_qcm, 0;simple_french_qcm, simple_french_qcm, 0;ml_french_qcm, ml_french_qcm, 0', port=8868, middles=None, start=False, userpwd=None, debug=False, fLOG=<built-in function print>)¶
Creates a local web-application with very simple authentification.
- Paramètres
secret_log – to encrypt log (None to ignore)
folder – folder where to write the logs (None to disable the logging)
max_age – cookie’s duration in seconds
cookie_key – to encrypt information in the cookie (cannot be None)
cookie_name – name of the session cookie
cookie_domain – cookie is valid for this path only, also defines the domain of the web app (its url)
cookie_path – path of the cookie once storeds
secure – use secured connection for cookies
title – title
short_title – short application title
page_doc – page documentation (default is :epkg:`mathenjeu`)
display – display such as
DisplayQuestionChoiceHTML
fct_game – function lambda name:
ActivityGroup
games – defines which games is available as a dictionary
{ game_id: (game name, first page id) }
orid,name,page;id,name,page
, id can be a filename.port – port to deploy the application
middles – middles ware, list of couple
[(class, **kwargs)]
where kwargs are the parameter constructorstart – starts the application with uvicorn
userpwd – users are authentified with any alias but a common password
debug – display debug information (starlette option)
fLOG – logging function
- Renvoie
Creates a local web-application with very simple authentification
The command line runs a web application meant to be local as there is not https involved. It implements a Q&A. The web app relies on starlette, the server relies on uvicorn. Example of use:
python -m mathenjeu qcm_local --cookie_key=dummypwd --start=1 --port=8889 --userpwd=abc
With that application, every user can login with a unique password abc.
<<<
python -m mathenjeu qcm_local --help
>>>
usage: qcm_local [-h] [-s SECRET_LOG] [-f FOLDER] [-m MAX_AGE] [-c COOKIE_KEY] [-co COOKIE_NAME] [-coo COOKIE_DOMAIN] [--cookie_path COOKIE_PATH] [-t TITLE] [-sh SHORT_TITLE] [-p PAGE_DOC] [-se SECURE] [-d DISPLAY] [-fc FCT_GAME] [-g GAMES] [-po PORT] [-mi MIDDLES] [-st START] [-u USERPWD] [-de DEBUG] Creates a local web-application with very simple authentification. optional arguments: -h, --help show this help message and exit -s SECRET_LOG, --secret_log SECRET_LOG to encrypt log (None to ignore) (default: ) -f FOLDER, --folder FOLDER folder where to write the logs (None to disable the logging) (default: .) -m MAX_AGE, --max_age MAX_AGE cookie's duration in seconds (default: 1209600) -c COOKIE_KEY, --cookie_key COOKIE_KEY to encrypt information in the cookie (cannot be None) (default: ) -co COOKIE_NAME, --cookie_name COOKIE_NAME name of the session cookie (default: mathenjeu) -coo COOKIE_DOMAIN, --cookie_domain COOKIE_DOMAIN cookie is valid for this path only, also defines the domain of the web app (its url) (default: 127.0.0.1) --cookie_path COOKIE_PATH path of the cookie once storeds (default: /) -t TITLE, --title TITLE title (default: Web Application MathEnJeu) -sh SHORT_TITLE, --short_title SHORT_TITLE short application title (default: MathEnJeu) -p PAGE_DOC, --page_doc PAGE_DOC page documentation (default is `mathenjeu`) (default: http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/) -se SECURE, --secure SECURE use secured connection for cookies (default: False) -d DISPLAY, --display DISPLAY display such as :class:`DisplayQuestionChoiceHTML <mat henjeu.apps.display.html_display.DisplayQuestionChoice HTML>` (default: ) -fc FCT_GAME, --fct_game FCT_GAME function *lambda name:* :class:`ActivityGroup <mathenjeu.activities.base_classes.ActivityGroup>` (default: ) -g GAMES, --games GAMES defines which games is available as a dictionary ``{ game_id: (game name, first page id) }`` or ``id,name,page;id,name,page``, *id* can be a filename. (default: simple_cinema_qcm,simple_cinema_qcm,0;simple _french_qcm,simple_french_qcm,0;ml_french_qcm,ml_frenc h_qcm,0) -po PORT, --port PORT port to deploy the application (default: 8868) -mi MIDDLES, --middles MIDDLES middles ware, list of couple ``[(class, **kwargs)]`` where *kwargs* are the parameter constructor (default: ) -st START, --start START starts the application with `uvicorn` (default: False) -u USERPWD, --userpwd USERPWD users are authentified with any alias but a common password (default: ) -de DEBUG, --debug DEBUG display debug information (`starlette` option) (default: False)