コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 7 of about 7 for mount (0.002 sec.)
Sub Applications - Mounts 12959
Sub Applications - Mounts Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you need to have two independent FastAPI applications, with their own independent Open ... API and their own docs UIs, you can have a main app and "mount" one (or more) sub-application(s). Mounting a FastAPI application "Mounting" means adding a completely "independent" appli ... p" } subapi = FastAPI () @subapi . get ( "/sub" ) def read_sub (): return { "message" : "Hello World from sub API" } app . mount ( "/subapi" , subapi ) Sub-application Then, create your sub-application, and its path operations . This sub-application i ... s just another standard FastAPI application, but this is the one that will be "mounted": Python 3.8+ from fastapi import FastAPI app = FastAPI () @app . get ( "/app" ) def read_main (): return { "message" : ...
https://man.mtool.work/fastapi/0.115/advanced/sub-applications/
Including WSGI - Flask, Django, others 10305
Including WSGI - Flask, Django, others Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can mount WSGI applications as you saw with Sub Applications - Mounts , ... Using WSGIMiddleware You need to import WSGIMiddleware . Then wrap the WSGI (e.g. Flask) app with the middleware. And then mount that under a path. Python 3.8+ from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from flask i ... ( name ) } from Flask!" app = FastAPI () @app . get ( "/v2" ) def read_main (): return { "message" : "Hello World" } app . mount ( "/v1" , WSGIMiddleware ( flask_app )) Check it Now, every request under the path /v1/ will be handled by the Flask appli ...
https://man.mtool.work/fastapi/0.115/advanced/wsgi/
Custom Docs UI Static Assets (Self-Hosting) 8978
Custom Docs UI Static Assets (Self-Hosting) Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . The API docs use Swagger UI and ReDoc , and each of those need some Jav ... ── 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 3.8+ from fastapi import FastAPI from fastapi.openapi.docs import ( g ... 2_redirect_html , ) from fastapi.staticfiles import StaticFiles app = FastAPI ( docs_url = None , redoc_url = None ) app . mount ( "/static" , StaticFiles ( directory = "static" ), name = "static" ) @app . get ( "/docs" , include_in_schema = False ) a ... 2_redirect_html , ) from fastapi.staticfiles import StaticFiles app = FastAPI ( docs_url = None , redoc_url = None ) app . mount ( "/static" , StaticFiles ( directory = "static" ), name = "static" ) @app . get ( "/docs" , include_in_schema = False ) a ...
https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
静的ファイル 8070
静的ファイル StaticFiles を使用して、ディレクトリから静的ファイルを自動的に提供できます。 StaticFiles の使用 StaticFiles をインポート。 StaticFiles() インスタンスを生成し、特定のパスに「マウント」。 Python 3.8+ from fastapi import FastAPI f ... rom fastapi.staticfiles import StaticFiles app = FastAPI () app . mount ( "/static" , StaticFiles ( directory = "static" ), name = "static" ) 技術詳細 from starlette.staticfiles import StaticFil ...
https://man.mtool.work/fastapi/0.115/tutorial/static-files/
Templates 7997
Templates Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use any template engine you want with FastAPI . A common choice is Jinja2, the same one used by F ... Response from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI () app . mount ( "/static" , StaticFiles ( directory = "static" ), name = "static" ) templates = Jinja2Templates ( directory = "templates ... ates and static files You can also use url_for() inside of the template, and use it, for example, with the StaticFiles you mounted with the name="static" . <html> <head> <title>Item Details</title> <link href=" {{ url_for ( 'static' , path = '/styles. ...
https://man.mtool.work/fastapi/0.115/advanced/templates/
Behind a Proxy 7652
Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration ... is built on, through Starlette). The root_path is used to handle these specific cases. And it's also used internally when mounting sub-applications. Proxy with a stripped path prefix Having a proxy with a stripped path prefix, in this case, means tha ... : "Hello World" , "root_path" : request . scope . get ( "root_path" )} and then it won't include it in the OpenAPI schema. Mounting a sub-application If you need to mount a sub-application (as described in Sub Applications - Mounts ) while also using ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
Bigger Applications - Multiple Files 7579
Bigger Applications - Multiple Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you are building an application or a web API, it's rarely the case that you ... . Very Technical Details Note : this is a very technical detail that you probably can just skip . The APIRouter s are not "mounted", they are not isolated from the rest of the application. This is because we want to include their path operations in th ... e OpenAPI schema and the user interfaces. As we cannot just isolate them and "mount" them independently of the rest, the path operations are "cloned" (re-created), not included directly. Check the automatic ...
https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
PREV 1 NEXT