Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 88 for config (6.11 sec)

  1. docs_src/settings/app01/main.py

    from fastapi import FastAPI
    
    from .config import settings
    
    app = FastAPI()
    
    
    @app.get("/info")
    async def info():
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
            "items_per_user": settings.items_per_user,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jul 29 09:26:07 GMT 2021
    - 267 bytes
    - Viewed (0)
  2. .github/workflows/label-approved.yml

          env:
            GITHUB_CONTEXT: ${{ toJson(github) }}
          run: echo "$GITHUB_CONTEXT"
        - uses: docker://tiangolo/label-approved:0.0.4
          with:
            token: ${{ secrets.FASTAPI_LABEL_APPROVED }}
            config: >
              {
                "approved-1":
                  {
                    "number": 1,
                    "await_label": "awaiting-review"
                  }
    Others
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jan 22 18:43:10 GMT 2024
    - 610 bytes
    - Viewed (0)
  3. tests/test_custom_schema_fields.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
    
        if PYDANTIC_V2:
            model_config = {
                "json_schema_extra": {
                    "x-something-internal": {"level": 4},
                }
            }
        else:
    
            class Config:
                schema_extra = {
                    "x-something-internal": {"level": 4},
                }
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  4. docs/zh/docs/advanced/settings.md

    ### 从 `.env` 文件中读取设置
    
    然后,您可以使用以下方式更新您的 `config.py`:
    
    ```Python hl_lines="9-10"
    {!../../../docs_src/settings/app03/config.py!}
    ```
    
    在这里,我们在 Pydantic 的 `Settings` 类中创建了一个名为 `Config` 的类,并将 `env_file` 设置为我们想要使用的 dotenv 文件的文件名。
    
    !!! tip
        `Config` 类仅用于 Pydantic 配置。您可以在<a href="https://docs.pydantic.dev/latest/api/config/" class="external-link" target="_blank">Pydantic Model Config</a>中阅读更多相关信息。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 13.9K bytes
    - Viewed (0)
  5. docs/en/docs/release-notes.md

        * You can read more about it in the docs for [Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/).
    * The attribute `schema_extra` for the internal class `Config` has been replaced by the key `json_schema_extra` in the new `model_config` dict.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 03 23:25:42 GMT 2024
    - 388.1K bytes
    - Viewed (1)
  6. docs_src/sql_databases/sql_app/schemas.py

        pass
    
    
    class Item(ItemBase):
        id: int
        owner_id: int
    
        class Config:
            orm_mode = True
    
    
    class UserBase(BaseModel):
        email: str
    
    
    class UserCreate(UserBase):
        password: str
    
    
    class User(UserBase):
        id: int
        is_active: bool
        items: List[Item] = []
    
        class Config:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 502 bytes
    - Viewed (0)
  7. scripts/mkdocs_hooks.py

        if "favicon" in config.theme:
            resolve_file(item=config.theme["favicon"], files=files, config=config)
        resolve_files(items=config.extra_css, files=files, config=config)
        resolve_files(items=config.extra_javascript, files=files, config=config)
        return files
    
    
    def generate_renamed_section_items(
        items: List[Union[Page, Section, Link]], *, config: MkDocsConfig
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/schema-extra-example.md

        ```
    
    추가 정보는 있는 그대로 해당 모델의 **JSON 스키마** 결과에 추가되고, API 문서에서 사용합니다.
    
    === "Pydantic v2"
    
        Pydantic 버전 2에서 <a href="https://docs.pydantic.dev/latest/usage/model_config/" class="external-link" target="_blank">Pydantic 공식 문서: Model Config</a>에 나와 있는 것처럼 `dict`를 받는 `model_config` 어트리뷰트를 사용할 것입니다.
    
        `"json_schema_extra"`를 생성된 JSON 스키마에서 보여주고 싶은 별도의 데이터와 `examples`를 포함하는 `dict`으로 설정할 수 있습니다.
    
    === "Pydantic v1"
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Feb 09 12:35:46 GMT 2024
    - 13.6K bytes
    - Viewed (0)
  9. 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,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 406 bytes
    - Viewed (0)
  10. docs_src/settings/app02/test_main.py

    from fastapi.testclient import TestClient
    
    from .config import Settings
    from .main import app, get_settings
    
    client = TestClient(app)
    
    
    def get_settings_override():
        return Settings(admin_email="******@****.***")
    
    
    app.dependency_overrides[get_settings] = get_settings_override
    
    
    def test_app():
        response = client.get("/info")
        data = response.json()
        assert data == {
            "app_name": "Awesome API",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jul 29 09:26:07 GMT 2021
    - 515 bytes
    - Viewed (0)
Back to top