Home / Function/ __init__() — fastapi Function Reference

__init__() — fastapi Function Reference

Architecture documentation for the __init__() function in applications.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  bef02968_6cae_fc82_e854_8b053afd9655["__init__()"]
  587454b3_6db6_011f_9fa4_3e4e2e09b72d["FastAPI"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|defined in| 587454b3_6db6_011f_9fa4_3e4e2e09b72d
  c029d7d0_68b4_7ce7_47cc_25c5b9dccd5d["setup()"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|calls| c029d7d0_68b4_7ce7_47cc_25c5b9dccd5d
  d15d0d82_652d_c556_d699_e3ccf1192b8e["get()"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|calls| d15d0d82_652d_c556_d699_e3ccf1192b8e
  2d8f2368_f214_e28c_d224_5dd3affead89["post()"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|calls| 2d8f2368_f214_e28c_d224_5dd3affead89
  28261a63_2ba9_f1ff_1d1b_475348a45a65["Default()"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|calls| 28261a63_2ba9_f1ff_1d1b_475348a45a65
  a6fa15d9_f44d_3cc7_31d5_290623927d05["exception_handler()"]
  bef02968_6cae_fc82_e854_8b053afd9655 -->|calls| a6fa15d9_f44d_3cc7_31d5_290623927d05
  style bef02968_6cae_fc82_e854_8b053afd9655 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/applications.py lines 64–999

    def __init__(
        self: AppType,
        *,
        debug: Annotated[
            bool,
            Doc(
                """
                Boolean indicating if debug tracebacks should be returned on server
                errors.

                Read more in the
                [Starlette docs for Applications](https://www.starlette.dev/applications/#instantiating-the-application).
                """
            ),
        ] = False,
        routes: Annotated[
            Optional[list[BaseRoute]],
            Doc(
                """
                **Note**: you probably shouldn't use this parameter, it is inherited
                from Starlette and supported for compatibility.

                ---

                A list of routes to serve incoming HTTP and WebSocket requests.
                """
            ),
            deprecated(
                """
                You normally wouldn't use this parameter with FastAPI, it is inherited
                from Starlette and supported for compatibility.

                In FastAPI, you normally would use the *path operation methods*,
                like `app.get()`, `app.post()`, etc.
                """
            ),
        ] = None,
        title: Annotated[
            str,
            Doc(
                """
                The title of the API.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more in the
                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).

                **Example**

                ```python
                from fastapi import FastAPI

                app = FastAPI(title="ChimichangApp")
                ```
                """
            ),
        ] = "FastAPI",
        summary: Annotated[
            Optional[str],
            Doc(
                """
                A short summary of the API.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more in the
                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).

                **Example**

                ```python
                from fastapi import FastAPI

                app = FastAPI(summary="Deadpond's favorite app. Nuff said.")
                ```
                """
            ),
        ] = None,
        description: Annotated[
            str,

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the fastapi codebase, defined in fastapi/applications.py.
Where is __init__() defined?
__init__() is defined in fastapi/applications.py at line 64.
What does __init__() call?
__init__() calls 5 function(s): Default, exception_handler, get, post, setup.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free