- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 44 for _get_settings (0.13 sec)
-
docs_src/settings/app02/main.py
from functools import lru_cache from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Settings = Depends(get_settings)): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 406 bytes - Viewed (0) -
docs_src/settings/app02_an_py39/main.py
from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 445 bytes - Viewed (0) -
docs_src/settings/app03_an_py39/main.py
from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 462 bytes - Viewed (0) -
docs_src/settings/app03/main.py
from functools import lru_cache from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: config.Settings = Depends(get_settings)): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 412 bytes - Viewed (0) -
docs_src/settings/app02_an/main.py
from fastapi import Depends, FastAPI from typing_extensions import Annotated from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 456 bytes - Viewed (0) -
docs_src/settings/app03_an/main.py
from typing import Annotated from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 451 bytes - Viewed (0) -
tests/test_tutorial/test_settings/test_app02.py
@needs_pydanticv2 def test_settings(monkeypatch: MonkeyPatch): from docs_src.settings.app02 import main monkeypatch.setenv("ADMIN_EMAIL", "******@****.***") settings = main.get_settings() assert settings.app_name == "Awesome API" assert settings.items_per_user == 50 @needs_pydanticv2 def test_override_settings(): from docs_src.settings.app02 import test_main
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 488 bytes - Viewed (0) -
docs/em/docs/advanced/settings.md
๐ฅ ๐ ๐ข ๐: ```Python def get_settings(): return Settings() ``` ๐ฅ ๐ โ ๐ ๐ ๐ ๐จ, & ๐ฅ ๐ ๐ `.env` ๐ ๐ ๐จ. ๐ถ ๐ถ โ๏ธ ๐ฅ โ๏ธ `@lru_cache` ๐จโ๐จ ๐ ๐, `Settings` ๐ ๐ โ ๐ด ๐, ๐ฅ ๐ฐ โซ๏ธ ๐ค. ๐ถ ๐ถ ```Python hl_lines="1 10" {!../../../docs_src/settings/app03/main.py!} ```
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri Mar 22 01:42:11 UTC 2024 - 11.4K bytes - Viewed (0) -
docs/en/docs/advanced/settings.md
```Python hl_lines="1 10" {!> ../../../docs_src/settings/app03/main.py!} ``` Then for any subsequent calls of `get_settings()` in the dependencies for the next requests, instead of executing the internal code of `get_settings()` and creating a new `Settings` object, it will return the same object that was returned on the first call, again and again. #### `lru_cache` Technical Details
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Sat May 18 23:43:13 UTC 2024 - 15.7K bytes - Viewed (0) -
docs/de/docs/advanced/settings.md
```Python hl_lines="1 10" {!> ../../../docs_src/settings/app03/main.py!} ``` Dann wird bei allen nachfolgenden Aufrufen von `get_settings()`, in den Abhรคngigkeiten fรผr darauffolgende Requests, dasselbe Objekt zurรผckgegeben, das beim ersten Aufruf zurรผckgegeben wurde, anstatt den Code von `get_settings()` erneut auszufรผhren und ein neues `Settings`-Objekt zu erstellen. #### Technische Details zu `lru_cache`
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Sat Mar 30 20:17:14 UTC 2024 - 17.8K bytes - Viewed (0)