コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 5 of about 5 for staticfiles (0.006 sec.)
Static Files - StaticFiles 11711
Static Files - StaticFiles You can use the StaticFiles class to serve static files, like JavaScript, CSS, images, etc. Read more about it in the FastAPI docs for Static Files . You can import it directly from fastapi.staticfiles : from fast ... api.staticfiles import StaticFiles ::: fastapi.staticfiles.StaticFiles ...
https://man.mtool.work/fastapi/0.115/reference/staticfiles/
静的ファイル 10626
静的ファイル 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 StaticFiles も使用できます。 FastAPI は、開発者の利便性のために、 starlette.staticfiles と同じ fastapi.staticfiles ...
https://man.mtool.work/fastapi/0.115/tutorial/static-files/
Custom Docs UI Static Assets (Self-Hosting) 8751
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 ... ur project file structure looks like this: . ├── app │ ├── __init__.py │ ├── main.py Now create a directory to store those static files. Your new file structure could look like this: . ├── app │ ├── __init__.py │ ├── main.py └── static/ Download the files D ... ownload the static files needed for the docs and put them on that static/ directory. You can probably right-click each link and select an option s ... p │ ├── __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 3.8+ from fastapi import FastAPI from fa ...
https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
Templates 8383
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 ... Jinja2 template. Python 3.8+ 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 ( ... nience for you, the developer. But most of the available responses come directly from Starlette. The same with Request and StaticFiles . Writing templates Then you can write a template at templates/item.html with, for example: <html> <head> <title>Item Deta ... tion function read_item(id=id) . For example, with an ID of 42 , this would render: < a href = "/items/42" > Templates 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 nam ...
https://man.mtool.work/fastapi/0.115/advanced/templates/
Release Notes 6434
Release Notes Latest Changes 0.115.11 Fixes ? Add docs examples and tests (support) for Annotated custom validations, like AfterValidator , revert #13440 . PR #13442 by @tiangolo . New docs: Query Parameters and String Validations - Custom ... cs/de/docs/reference/security/index.md . PR #10839 by @nilslindemann . ? Add German translation for docs/de/docs/reference/staticfiles.md . PR #10841 by @nilslindemann . ? Add German translation for docs/de/docs/reference/testclient.md . PR #10843 by @nilsl ...
https://man.mtool.work/fastapi/0.115/release-notes/
PREV 1 NEXT