Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 138 for main (0.22 sec)

  1. docs/en/docs/tutorial/testing.md

    .
    ├── app
    │   ├── __init__.py
    │   ├── main.py
    │   └── test_main.py
    ```
    
    Because this file is in the same package, you can use relative imports to import the object `app` from the `main` module (`main.py`):
    
    ```Python hl_lines="3"
    {!../../../docs_src/app_testing/test_main.py!}
    ```
    
    ...and have the code for the tests just like before.
    
    ## Testing: extended example
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  2. docs/ko/docs/tutorial/debugging.md

    ## `uvicorn` 호출
    
    FastAPI 애플리케이션에서 `uvicorn`을 직접 임포트하여 실행합니다
    
    ```Python hl_lines="1  15"
    {!../../../docs_src/debugging/tutorial001.py!}
    ```
    
    ### `__name__ == "__main__"` 에 대하여
    
    `__name__ == "__main__"`의 주요 목적은 다음과 같이 파일이 호출될 때 실행되는 일부 코드를 갖는 것입니다.
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    그러나 다음과 같이 다른 파일을 가져올 때는 호출되지 않습니다.
    
    ```Python
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 04:18:08 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  3. docs/ru/docs/tutorial/first-steps.md

    <span style="color: green;">INFO</span>:     Application startup complete.
    ```
    
    </div>
    
    !!! note "Технические детали"
        Команда `uvicorn main:app` обращается к:
    
        * `main`: файл `main.py` (модуль Python).
        * `app`: объект, созданный внутри файла `main.py` в строке `app = FastAPI()`.
        * `--reload`: перезапускает сервер после изменения кода. Используйте только для разработки.
    
    В окне вывода появится следующая строка:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 13.1K bytes
    - Viewed (0)
  4. docs/ko/docs/deployment/server-workers.md

    ```
    
    </div>
    
    각 옵션이 무엇을 의미하는지 살펴봅시다:
    
    * 이것은 유비콘과 똑같은 문법입니다. `main`은 파이썬 모듈 네임 "`main`"을 의미하므로 `main.py`파일을 뜻합니다. 그리고 `app`은 **FastAPI** 어플리케이션이 들어 있는 변수의 이름입니다.
        * `main:app`이 파이썬의 `import` 문법과 흡사한 면이 있다는 걸 알 수 있습니다:
    
            ```Python
            from main import app
            ```
    
        * 곧, `main:app`안에 있는 콜론의 의미는 파이썬에서 `from main import app`에서의 `import`와 같습니다.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  5. docs/ru/docs/deployment/docker.md

    # (1)
    COPY ./main.py /code/
    
    # (2)
    CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
    ```
    
    1. Скопируйте непосредственно файл `main.py` в директорию `/code` (не указывайте `./app`).
    
    2. При запуске Uvicorn укажите ему, что объект `app` нужно импортировать из файла `main` (вместо импортирования из `app.main`).
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 57.5K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/first-steps.md

    <span style="color: green;">INFO</span>:     Application startup complete.
    ```
    
    </div>
    
    !!! note
        📋 `uvicorn main:app` 🔗:
    
        * `main`: 📁 `main.py` (🐍 "🕹").
        * `app`: 🎚 ✍ 🔘 `main.py` ⏮️ ⏸ `app = FastAPI()`.
        * `--reload`: ⚒ 💽 ⏏ ⏮️ 📟 🔀. 🕴 ⚙️ 🛠️.
    
    🔢, 📤 ⏸ ⏮️ 🕳 💖:
    
    ```hl_lines="4"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  7. docs/ja/docs/tutorial/first-steps.md

    <span style="color: green;">INFO</span>:     Application startup complete.
    ```
    
    </div>
    
    !!! note "備考"
        `uvicorn main:app`は以下を示します:
    
        * `main`: `main.py`ファイル (Python "module")。
        * `app`:  `main.py`内部で作られるobject(`app = FastAPI()`のように記述される)。
        * `--reload`: コードの変更時にサーバーを再起動させる。開発用。
    
    出力には次のような行があります:
    
    ```hl_lines="4"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.2K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/bigger-applications.md

    ## The main `FastAPI`
    
    Now, let's see the module at `app/main.py`.
    
    Here's where you import and use the class `FastAPI`.
    
    This will be the main file in your application that ties everything together.
    
    And as most of your logic will now live in its own specific module, the main file will be quite simple.
    
    ### Import `FastAPI`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  9. docs/ru/docs/tutorial/debugging.md

    В вашем FastAPI приложении, импортируйте и вызовите `uvicorn` напрямую:
    
    ```Python hl_lines="1  15"
    {!../../../docs_src/debugging/tutorial001.py!}
    ```
    
    ### Описание `__name__ == "__main__"`
    
    Главная цель использования `__name__ == "__main__"` в том, чтобы код выполнялся при запуске файла с помощью:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/sub-applications.md

    ```Python hl_lines="11  19"
    {!../../../docs_src/sub_applications/tutorial001.py!}
    ```
    
    ### Check the automatic API docs
    
    Now, run `uvicorn` with the main app, if your file is `main.py`, it would be:
    
    <div class="termy">
    
    ```console
    $ uvicorn main:app --reload
    
    <span style="color: green;">INFO</span>:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
    ```
    
    </div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.9K bytes
    - Viewed (0)
Back to top