In addition to the parameters mentioned elsewhere in this document, Kui also supports the following initialization parameters.
This parameter is used to add global HTTP middlewares.
This parameter is used to customize the HttpRequest class.
from kui.wsgi import Kui, HttpRequest
class CustomHttpRequest(HttpRequest):
...
app = Kui(
factory_class=FactoryClass(http=CustomHttpRequest),
)This parameter is used to customize the JSON encoder.
from kui.wsgi import Kui
from typedmongo import Table
app = Kui(json_encoder={
Table: lambda table: table.dump(),
})app.state is used to store global variables.
app.should_exit is used to indicate whether the Application should be closed.
!!! notice This property requires support from the server being started.