Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 48 for mount (0.2 sec)

  1. docs/en/docs/advanced/wsgi.md

    # Including WSGI - Flask, Django, others
    
    You can mount WSGI applications as you saw with [Sub Applications - Mounts](sub-applications.md){.internal-link target=_blank}, [Behind a Proxy](behind-a-proxy.md){.internal-link target=_blank}.
    
    For that, you can use the `WSGIMiddleware` and use it to wrap your WSGI application, for example, Flask, Django, etc.
    
    ## Using `WSGIMiddleware`
    
    You need to import `WSGIMiddleware`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/static-files.md

    # 静态文件
    
    您可以使用 `StaticFiles`从目录中自动提供静态文件。
    
    ## 使用`StaticFiles`
    
    * 导入`StaticFiles`。
    * "挂载"(Mount) 一个 `StaticFiles()` 实例到一个指定路径。
    
    ```Python hl_lines="2  6"
    {!../../../docs_src/static_files/tutorial001.py!}
    ```
    
    !!! note "技术细节"
        你也可以用 `from starlette.staticfiles import StaticFiles`。
    
        **FastAPI** 提供了和 `starlette.staticfiles` 相同的 `fastapi.staticfiles` ,只是为了方便你,开发者。但它确实来自Starlette。
    
    ### 什么是"挂载"(Mounting)
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jun 03 12:49:32 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  3. docs_src/static_files/tutorial001.py

    from fastapi import FastAPI
    from fastapi.staticfiles import StaticFiles
    
    app = FastAPI()
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 159 bytes
    - Viewed (0)
  4. docs_src/sub_applications/tutorial001.py

    @app.get("/app")
    def read_main():
        return {"message": "Hello World from main app"}
    
    
    subapi = FastAPI()
    
    
    @subapi.get("/sub")
    def read_sub():
        return {"message": "Hello World from sub API"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jun 11 21:53:19 GMT 2020
    - 274 bytes
    - Viewed (0)
  5. docs/fa/docs/advanced/sub-applications.md

    # زیر برنامه ها - اتصال
    
    اگر نیاز دارید که دو برنامه مستقل FastAPI، با OpenAPI مستقل و رابط‌های کاربری اسناد خود داشته باشید، می‌توانید یک برنامه
    اصلی داشته باشید و یک (یا چند) زیر برنامه را به آن متصل کنید.
    
    ## اتصال (mount) به یک برنامه **FastAPI**
    
    کلمه "Mounting" به معنای افزودن یک برنامه کاملاً مستقل در یک مسیر خاص است، که پس از آن مدیریت همه چیز در آن مسیر، با path operations (عملیات های مسیر) اعلام شده در آن زیر برنامه می باشد.
    
    ### برنامه سطح بالا
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/sub-applications.md

    ```Python hl_lines="11  14-16"
    {!../../../docs_src/sub_applications/tutorial001.py!}
    ```
    
    ### Mount the sub-application
    
    In your top-level application, `app`, mount the sub-application, `subapi`.
    
    In this case, it will be mounted at the path `/subapi`:
    
    ```Python hl_lines="11  19"
    {!../../../docs_src/sub_applications/tutorial001.py!}
    ```
    
    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)
  7. docs_src/wsgi/tutorial001.py

        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"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue May 09 14:32:00 GMT 2023
    - 443 bytes
    - Viewed (0)
  8. docs/en/docs/how-to/custom-docs-ui-assets.md

    │   ├── __init__.py
    │   ├── main.py
    └── static
        ├── redoc.standalone.js
        ├── swagger-ui-bundle.js
        └── swagger-ui.css
    ```
    
    ### Serve the static files
    
    * Import `StaticFiles`.
    * "Mount" a `StaticFiles()` instance in a specific path.
    
    ```Python hl_lines="7  11"
    {!../../../docs_src/custom_docs_ui/tutorial002.py!}
    ```
    
    ### Test the static files
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Oct 30 09:58:58 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  9. docs_src/templates/tutorial001.py

    from fastapi import FastAPI, Request
    from fastapi.responses import HTMLResponse
    from fastapi.staticfiles import StaticFiles
    from fastapi.templating import Jinja2Templates
    
    app = FastAPI()
    
    app.mount("/static", StaticFiles(directory="static"), name="static")
    
    
    templates = Jinja2Templates(directory="templates")
    
    
    @app.get("/items/{id}", response_class=HTMLResponse)
    async def read_item(request: Request, id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Dec 26 20:12:34 GMT 2023
    - 521 bytes
    - Viewed (0)
  10. docs/de/docs/advanced/sub-applications.md

    ### Technische Details: `root_path`
    
    Wenn Sie eine Unteranwendung wie oben beschrieben mounten, kümmert sich FastAPI darum, den Mount-Pfad für die Unteranwendung zu kommunizieren, mithilfe eines Mechanismus aus der ASGI-Spezifikation namens `root_path`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:18:06 GMT 2024
    - 3.3K bytes
    - Viewed (0)
Back to top