module cli.static_app
¶
Short summary¶
module mathenjeu.cli.static_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.static_app.create_static_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, port=8868, middles=None, start=False, userpwd=None, debug=False, content=None, 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”)
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)
content – list tuple
route, folder
to server or a stringroute1,folder1;route2,folder2;...
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 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.
- mathenjeu.cli.static_app.create_static_local_app(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu', cookie_domain='127.0.0.1', cookie_path='/', content=None, title='Web Application MathEnJeu', short_title='MathEnJeu', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, 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
content – list tuple
route, folder
to server or a stringroute1,folder1;route2,folder2;...
title – title
short_title – short application title
page_doc – page documentation (default is :epkg:`mathenjeu`)
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 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)