Command lines

  1. Creates a https static web-application with authentification

  2. Creates a https web-application (Q&A) with authentification

  3. Creates a local web-application with very simple authentification

  4. Creates a local web-application with very simple authentification

  5. Creates a signed certificate

Creates a https static web-application with authentification

The command line runs a web application meant to be local as there is not https involved. It servers static content. The web app relies on starlette, the server relies on hypercorn. Example:

python -m mathenjeu local_https

With that application, every user can login with a unique password abc.

<<<

python -m mathenjeu local_https --help

>>>

Command not found: 'local_https'.

Available commands:

    create_self_signed_cert   Creates a signed certificate.
    qcm_https                 Creates a https web-application with https authentification.
    qcm_local                 Creates a local web-application with very simple authentification.
    static_https              Creates a https web-application with https authentification.
    static_local              Creates a local web-application with very simple authentification.

(entrée originale : static_app.py:docstring of mathenjeu.cli.static_app.create_static_https_app, line 39)

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_french_qcm,simple_french_qcm,0;ml_fre
                        nch_qcm,ml_french_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)

(entrée originale : qcm_app.py:docstring of mathenjeu.cli.qcm_app.create_qcm_https_app, line 42)

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_french_qcm,simple_french_qcm,0;ml_fre
                        nch_qcm,ml_french_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)

(entrée originale : qcm_app.py:docstring of mathenjeu.cli.qcm_app.create_qcm_local_app, line 29)

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 serves static content. The web app relies on starlette, the server relies on uvicorn. Example of use:

python -m mathenjeu static_local --cookie_key=dummypwd --start=1 --port=8889 --userpwd=abc --content=display_name,local_folder

With that application, every user can login with a unique password abc.

<<<

python -m mathenjeu static_local --help

>>>

usage: static_local [-h] [-s SECRET_LOG] [-f FOLDER] [-m MAX_AGE]
                    [-c COOKIE_KEY] [-co COOKIE_NAME] [-coo COOKIE_DOMAIN]
                    [--cookie_path COOKIE_PATH] [-con CONTENT] [-t TITLE]
                    [-sh SHORT_TITLE] [-p PAGE_DOC] [-se SECURE] [-po PORT]
                    [-mi MIDDLES] [-st START] [-u USERPWD] [-d 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: /)
  -con CONTENT, --content CONTENT
                        list tuple ``route, folder`` to server or a string
                        ``route1,folder1;route2,folder2;...`` (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)
  -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: )
  -d DEBUG, --debug DEBUG
                        display debug information (`starlette` option)
                        (default: False)

(entrée originale : static_app.py:docstring of mathenjeu.cli.static_app.create_static_local_app, line 26)

Creates a signed certificate

The command line creates a certificate used later by a service such as hypercorn or waitress. Example:

python -m mathenjeu create_self_signed_cert --keyfile=key.pem --certfile=cert.pem

<<<

python -m mathenjeu create_self_signed_cert --help

>>>

usage: create_self_signed_cert [-h] [-k KEYFILE] [-c CERTFILE] [-co COUNTRY]
                               [-s STATE] [-l LOCATION] [-o ORGANIZATION]
                               [--cn CN] [-or ORGANIZATIONAL_UNIT_NAME]
                               [-e EMAIL] [-si SIZE] [-d DAYS] [-a ALGO]

Creates a signed certificate.

optional arguments:
  -h, --help            show this help message and exit
  -k KEYFILE, --keyfile KEYFILE
                        key file (default: key.pem)
  -c CERTFILE, --certfile CERTFILE
                        certificate file (default: cert.pem)
  -co COUNTRY, --country COUNTRY
                        country (default: FR)
  -s STATE, --state STATE
                        state (default: Paris)
  -l LOCATION, --location LOCATION
                        location (default: Paris)
  -o ORGANIZATION, --organization ORGANIZATION
                        organization (default: mathenjeu)
  --cn CN               common name (default: mathenjeu)
  -or ORGANIZATIONAL_UNIT_NAME, --organizational_unit_name ORGANIZATIONAL_UNIT_NAME
                        organizational unit name (can be empty) (default: )
  -e EMAIL, --email EMAIL
                        email (can be empty) (default: )
  -si SIZE, --size SIZE
                        key size (default: 4096)
  -d DAYS, --days DAYS  days it is valid (default: 365)
  -a ALGO, --algo ALGO  algorithm (default: sha256)

(entrée originale : openssl.py:docstring of mathenjeu.cli.openssl.create_self_signed_cert, line 22)