module apps.staticapp.staticsite

Inheritance diagram of mathenjeu.apps.staticapp.staticsite

Short summary

module mathenjeu.apps.staticapp.staticsite

Starts an application.

source on GitHub

Classes

class

truncated documentation

StaticApp

Implements routes for a web application which serves static files protected with a password. See Which server to server starlette application?. …

Methods

method

truncated documentation

__init__

cleanup

Cleans up.

event

This route does not return anything interesting except a blank page, but it logs

main

Defines the main page.

not_found

Returns an HTTP 404 page.

on_error

An example error.

page_context

Returns the page context before applying any template.

server_error

Returns an HTTP 500 page.

startup

Startups.

unlogged_response

Returns an answer for somebody looking to access the questions without being authentified.

Documentation

Starts an application.

source on GitHub

class mathenjeu.apps.staticapp.staticsite.StaticApp(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu_static', cookie_domain='127.0.0.1', cookie_path='/', content=None, title='MathEnJeu - Static Files', short_title='MEJ', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, middles=None, debug=False, userpwd=None)

Bases : mathenjeu.apps.common.log_app.LogApp, mathenjeu.apps.common.auth_app.AuthentificationAnswers

Implements routes for a web application which serves static files protected with a password. See Which server to server starlette application?. The application allows anybody to connect to the website assuming the know the password.

source on GitHub

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

  • title – title

  • short_title – short application title

  • middles – middles ware, list of couple [(class, **kwargs)] where kwargs are the parameter constructor

  • userpwd – users are authentified with any alias but a common password

  • debug – display debug information (starlette option)

source on GitHub

__init__(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu_static', cookie_domain='127.0.0.1', cookie_path='/', content=None, title='MathEnJeu - Static Files', short_title='MEJ', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, middles=None, debug=False, userpwd=None)
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

  • title – title

  • short_title – short application title

  • middles – middles ware, list of couple [(class, **kwargs)] where kwargs are the parameter constructor

  • userpwd – users are authentified with any alias but a common password

  • debug – display debug information (starlette option)

source on GitHub

cleanup()

Cleans up.

source on GitHub

async event(request)

This route does not return anything interesting except a blank page, but it logs

async main(request)

Defines the main page.

async not_found(request, exc)

Returns an HTTP 404 page.

async on_error(request)

An example error.

page_context(**kwargs)

Returns the page context before applying any template.

Paramètres

kwargs – arguments

Renvoie

parameters

source on GitHub

async server_error(request, exc)

Returns an HTTP 500 page.

startup()

Startups.

source on GitHub

unlogged_response(request, session)

Returns an answer for somebody looking to access the questions without being authentified.

source on GitHub