Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 30 for __name__ (0.04 seconds)

  1. docs/zh-hant/docs/tutorial/debugging.md

    你可以在編輯器中連接偵錯器,例如 Visual Studio Code 或 PyCharm。
    
    ## 呼叫 `uvicorn` { #call-uvicorn }
    
    在你的 FastAPI 應用程式中,直接匯入並執行 `uvicorn`:
    
    {* ../../docs_src/debugging/tutorial001_py310.py hl[1,15] *}
    
    ### 關於 `__name__ == "__main__"` { #about-name-main }
    
    `__name__ == "__main__"` 的主要目的是,當你的檔案以以下方式呼叫時,執行某些程式碼:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    但當其他檔案匯入它時不會執行,例如:
    
    ```Python
    from myapp import app
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 2.4K bytes
    - Click Count (0)
  2. docs/en/docs/tutorial/debugging.md

    ## Call `uvicorn` { #call-uvicorn }
    
    In your FastAPI application, import and run `uvicorn` directly:
    
    {* ../../docs_src/debugging/tutorial001_py310.py hl[1,15] *}
    
    ### About `__name__ == "__main__"` { #about-name-main }
    
    The main purpose of the `__name__ == "__main__"` is to have some code that is executed when your file is called with:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 2.4K bytes
    - Click Count (0)
  3. docs/zh/docs/tutorial/debugging.md

    你可以在编辑器中连接调试器,例如使用 Visual Studio Code 或 PyCharm。
    
    ## 调用 `uvicorn` { #call-uvicorn }
    
    在你的 FastAPI 应用中直接导入 `uvicorn` 并运行:
    
    {* ../../docs_src/debugging/tutorial001_py310.py hl[1,15] *}
    
    ### 关于 `__name__ == "__main__"` { #about-name-main }
    
    `__name__ == "__main__"` 的主要目的是使用以下代码调用文件时执行一些代码:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    而当其它文件导入它时并不会被调用,像这样:
    
    ```Python
    from myapp import app
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 2.4K bytes
    - Click Count (0)
  4. docs/ja/docs/tutorial/debugging.md

    ## `uvicorn` を呼び出す { #call-uvicorn }
    
    FastAPIアプリケーション上で、`uvicorn` を直接インポートして実行します:
    
    {* ../../docs_src/debugging/tutorial001_py310.py hl[1,15] *}
    
    ### `__name__ == "__main__"` について { #about-name-main }
    
    `__name__ == "__main__"` の主な目的は、ファイルが次のコマンドで呼び出されたときに実行されるコードを用意することです:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    ただし、次のように、別のファイルからインポートされるときには呼び出されません:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 3.1K bytes
    - Click Count (0)
  5. docs/ko/docs/tutorial/debugging.md

    ## `uvicorn` 호출 { #call-uvicorn }
    
    FastAPI 애플리케이션에서 `uvicorn`을 직접 임포트하여 실행합니다:
    
    {* ../../docs_src/debugging/tutorial001_py310.py hl[1,15] *}
    
    ### `__name__ == "__main__"` 에 대하여 { #about-name-main }
    
    `__name__ == "__main__"`의 주요 목적은 다음과 같이 파일이 호출될 때 실행되는 일부 코드를 갖는 것입니다.
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    그러나 다음과 같이 다른 파일을 가져올 때는 호출되지 않습니다.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 2.8K bytes
    - Click Count (0)
  6. fastapi/security/http.py

            description: str | None = None,
            auto_error: bool = True,
        ):
            self.model = HTTPBaseModel(scheme=scheme, description=description)
            self.scheme_name = scheme_name or self.__class__.__name__
            self.auto_error = auto_error
    
        def make_authenticate_headers(self) -> dict[str, str]:
            return {"WWW-Authenticate": f"{self.model.scheme.title()}"}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 16 10:16:48 GMT 2026
    - 13.1K bytes
    - Click Count (0)
  7. docs_src/wsgi/tutorial001_py310.py

    from a2wsgi import WSGIMiddleware
    from fastapi import FastAPI
    from flask import Flask, request
    from markupsafe import escape
    
    flask_app = Flask(__name__)
    
    
    @flask_app.route("/")
    def flask_main():
        name = request.args.get("name", "World")
        return f"Hello, {escape(name)} from Flask!"
    
    
    app = FastAPI()
    
    
    @app.get("/v2")
    def read_main():
        return {"message": "Hello World"}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 426 bytes
    - Click Count (0)
  8. docs_src/debugging/tutorial001_py310.py

    import uvicorn
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def root():
        a = "a"
        b = "b" + a
        return {"hello world": b}
    
    
    if __name__ == "__main__":
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 223 bytes
    - Click Count (0)
  9. scripts/add_latest_release_date.py

            with open(RELEASE_NOTES_FILE, "w") as f:
                f.writelines(lines)
            sys.exit(0)
    
        print("No release header found")
        sys.exit(1)
    
    
    if __name__ == "__main__":
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Apr 03 12:06:36 GMT 2026
    - 1023 bytes
    - Click Count (0)
  10. fastapi/_compat/v2.py

            ModelField(
                field_info=FieldInfo(annotation=model),
                name=model.__name__,
                mode="validation",
            )
            for model in flat_validation_models
        ]
        flat_serialization_model_fields = [
            ModelField(
                field_info=FieldInfo(annotation=model),
                name=model.__name__,
                mode="serialization",
            )
            for model in flat_serialization_models
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 16.7K bytes
    - Click Count (0)
Back to Top