Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for Lifespan (0.04 sec)

  1. docs/en/docs/advanced/events.md

    /// info
    
    You can read more about the Starlette `lifespan` handlers in <a href="https://www.starlette.io/lifespan/" class="external-link" target="_blank">Starlette's  Lifespan' docs</a>.
    
    Including how to handle lifespan state that can be used in other areas of your code.
    
    ///
    
    ## Sub Applications { #sub-applications }
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 7.9K bytes
    - Viewed (0)
  2. docs/en/docs/advanced/testing-events.md

    # Testing Events: lifespan and startup - shutdown { #testing-events-lifespan-and-startup-shutdown }
    
    When you need `lifespan` to run in your tests, you can use the `TestClient` with a `with` statement:
    
    {* ../../docs_src/app_testing/tutorial004.py hl[9:15,18,27:28,30:32,41:43] *}
    
    
    You can read more details about the ["Running lifespan in tests in the official Starlette documentation site."](https://www.starlette.io/lifespan/#running-lifespan-in-tests)
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 10:29:21 UTC 2025
    - 615 bytes
    - Viewed (0)
  3. docs/en/docs/advanced/async-tests.md

    ///
    
    /// warning
    
    If your application relies on lifespan events, the `AsyncClient` won't trigger these events. To ensure they are triggered, use `LifespanManager` from <a href="https://github.com/florimondmanca/asgi-lifespan#usage" class="external-link" target="_blank">florimondmanca/asgi-lifespan</a>.
    
    ///
    
    ## Other Asynchronous Function Calls { #other-asynchronous-function-calls }
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 3.9K bytes
    - Viewed (0)
  4. docs/en/docs/deployment/https.md

    The domains are securely verified and the certificates are generated automatically. This also allows automating the renewal of these certificates.
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 19:34:08 UTC 2025
    - 14.3K bytes
    - Viewed (0)
  5. docs/en/docs/deployment/docker.md

    ```
    
    ⛔️ **Shell** form:
    
    ```Dockerfile
    # ⛔️ Don't do this
    CMD fastapi run app/main.py --port 80
    ```
    
    Make sure to always use the **exec** form to ensure that FastAPI can shutdown gracefully and [lifespan events](../advanced/events.md){.internal-link target=_blank} are triggered.
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 29.5K bytes
    - Viewed (1)
  6. docs/en/docs/release-notes.md

    
    ml_models = {}
    
    
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # Load the ML model
        ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
        yield
        # Clean up the ML models and release the resources
        ml_models.clear()
    
    
    app = FastAPI(lifespan=lifespan)
    
    
    @app.get("/predict")
    async def predict(x: float):
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Fri Sep 05 12:48:45 UTC 2025
    - 544.1K bytes
    - Viewed (0)
Back to top