[Python] What Starlette app state instances are allowed?

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    From the Starlette documentation:


    You can store arbitrary extra state on the application instance, using the generic app.state attribute.

    For example:

    app.state.ADMIN_EMAIL = 'admin@example.org'​

    What is the spectrum of "store arbitrary extra state" - from one or more database connections to an array to a large dictionary? Are mutable objects allowed as state?

    Continue reading...

Compartilhe esta Página