Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 28 for app_name (0.04 seconds)

  1. docs_src/settings/tutorial001_py310.py

    from fastapi import FastAPI
    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
    
    settings = 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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 419 bytes
    - Click Count (0)
  2. docs/ja/docs/advanced/settings.md

    /// tip | 豆知識
    
    コピペ用に手早く使いたい場合は、この例ではなく、下の最後の例を使ってください。
    
    ///
    
    その後、その `Settings` クラスのインスタンス(この例では `settings` オブジェクト)を作成すると、Pydantic は環境変数を大文字小文字を区別せずに読み取ります。つまり、大文字の `APP_NAME` という変数は、属性 `app_name` に対しても読み取られます。
    
    次に、データが変換・バリデーションされます。したがって、`settings` オブジェクトを使うと、宣言した型のデータ(例: `items_per_user` は `int`)が得られます。
    
    ### `settings` の使用 { #use-the-settings }
    
    次に、アプリケーションで新しい `settings` オブジェクトを使用できます:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 12.7K bytes
    - Click Count (0)
  3. docs_src/settings/app02_an_py310/config.py

    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 159 bytes
    - Click Count (0)
  4. docs_src/settings/app02_py310/config.py

    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 159 bytes
    - Click Count (0)
  5. docs_src/settings/app03_an_py310/config.py

    from pydantic_settings import BaseSettings, SettingsConfigDict
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 235 bytes
    - Click Count (0)
  6. docs/en/docs/advanced/settings.md

    ///
    
    Then, when you create an instance of that `Settings` class (in this case, in the `settings` object), Pydantic will read the environment variables in a case-insensitive way, so, an upper-case variable `APP_NAME` will still be read for the attribute `app_name`.
    
    Next it will convert and validate the data. So, when you use that `settings` object, you will have data of the types you declared (e.g. `items_per_user` will be an `int`).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 10.9K bytes
    - Click Count (0)
  7. docs_src/settings/app01_py310/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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 267 bytes
    - Click Count (0)
  8. docs_src/settings/app02_py310/main.py

    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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 406 bytes
    - Click Count (0)
  9. docs_src/settings/app03_py310/main.py

    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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 412 bytes
    - Click Count (0)
  10. docs_src/settings/app02_an_py310/main.py

    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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 445 bytes
    - Click Count (0)
Back to Top