Results of 1 - 10 of about 41 for starlette (0.002 sec.)
- ベンチマーク 12247
- ベンチマーク TechEmpowerの独立したベンチマークでは、Uvicornの下で動作する FastAPI アプリケーションは、 利用可能な最速のPythonフレームワークの1つ であり、下回っているのはStarletteとUvicorn自体 (FastAPIによって内部で使用される) のみだと示され
...さい。 ベンチマークと速度 ベンチマークを確認する時、異なるツールを同等なものと比較するのが一般的です。 具体的には、Uvicorn、Starlette、FastAPIを (他の多くのツールと) 比較しました。 ツールで解決する問題がシンプルなほど、パフォーマンスが向上します。また、ほと...どのベンチマークは、ツールから提供される追加機能をテストしていません。 階層関係はこのようになります。 Uvicorn : ASGIサーバー Starlette : (Uvicornを使用) WEBマイクロフレームワーク FastAPI : (Starletteを使用) データバリデーションなどの、APIを構築する追加機能を...いので、最高のパフォーマンスが得られます。 Uvicornにアプリケーションを直接書くことはできません。つまり、あなたのコードには、Starlette (または** FastAPI **) が提供するコードを、多かれ少なかれ含める必要があります。そうすると、最終的なアプリケーションは、フレ... - https://man.mtool.work/fastapi/0.115/benchmarks/
- エラーハンドリング 11283
- エラーハンドリング APIを使用しているクライアントにエラーを通知する必要がある状況はたくさんあります。 このクライアントは、フロントエンドを持つブラウザ、誰かのコード、IoTデバイスなどが考えられます。 クライアントに以下のようなことを伝える必要が
..."There goes my error" }, ) return { "item" : items [ item_id ]} カスタム例外ハンドラのインストール カスタム例外ハンドラは Starletteと同じ例外ユーティリティ を使用して追加することができます。 あなた(または使用しているライブラリ)が raise するかもしれないカ...確なエラーを受け取ることになります: { "message" : "Oops! yolo did something. There goes a rainbow..." } 技術詳細 また、 from starlette.requests import Request と from starlette.responses import JSONResponse を使用することもできます。 FastAPI は開発者の利便性...を考慮して、 fastapi.responses と同じ starlette.responses を提供しています。しかし、利用可能なレスポンスのほとんどはStarletteから直接提供されます。これは Request と同じで... - https://man.mtool.work/fastapi/0.115/tutorial/handling-errors/
- 代替ツールから受けたインスピレーションと比較 10475
- 代替ツールから受けたインスピレーションと比較 何が FastAPI にインスピレーションを与えたのか、他の代替ツールと比較してどうか、そしてそこから何を学んだのかについて。 はじめに FastAPI は、代替ツールのこれまでの働きがなければ存在しなかったでしょ
...に向けた「調査」を触発した最初のアイデアの一つでした。 備考 Django REST Framework は Tom Christie によって作成されました。StarletteとUvicornの生みの親であり、 FastAPI のベースとなっています。 FastAPI へ与えたインスピレーション 自動でAPIドキュメントを生成す...ます。 しかし、ドキュメントはまだ不足しています。そこでAPISpecが作られました。 これは多くのフレームワーク用のプラグインです (Starlette用のプラグインもあります) 。 仕組みとしては、各ルーティング関数のdocstringにYAML形式でスキーマの定義を記述します。 そして、O...penAPIスキーマを生成してくれます。 Flask, Starlette, Responderなどにおいてはそのように動作します。 しかし、Pythonの文字列 (大きなYAML) の中に、小さな構文があるという問題があり... - https://man.mtool.work/fastapi/0.115/alternatives/
- Using the Request Directly 9993
- Using the Request Directly Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Up to now, you have been declaring the parts of the request that you need with their typ
...ations where you might need to access the Request object directly. Details about the Request object As FastAPI is actually Starlette underneath, with a layer of several tools on top, you can use Starlette's Request object directly when you need to. It wou...dditionally, get the Request too. Request documentation You can read more details about the Request object in the official Starlette documentation site . Technical Details You could also use from starlette.requests import Request . FastAPI provides it dir...ectly just as a convenience for you, the developer. But it comes directly from Starlette.... - https://man.mtool.work/fastapi/0.115/advanced/using-request-directly/
- GraphQL 9993
- GraphQL Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the ASGI standard, it's very easy to integrate any GraphQL library also compatible w
...docs for FastAPI Ariadne With docs for FastAPI Tartiflette With Tartiflette ASGI to provide ASGI integration Graphene With starlette-graphene3 GraphQL with Strawberry If you need or want to work with GraphQL , Strawberry is the recommended library as it h...about Strawberry in the Strawberry documentation . And also the docs about Strawberry with FastAPI . Older GraphQLApp from Starlette Previous versions of Starlette included a GraphQLApp class to integrate with Graphene . It was deprecated from Starlette,...but if you have code that used it, you can easily migrate to starlette-graphene3 , that covers the same use case and has an almost identical interface . Tip If you need GraphQL, I still would r... - https://man.mtool.work/fastapi/0.115/how-to/graphql/
- Advanced Middleware 9916
- Advanced Middleware Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In the main tutorial you read how to add Custom Middleware to your application. And then you al
...he CORSMiddleware . In this section we'll see how to use other middlewares. Adding ASGI middlewares As FastAPI is based on Starlette and implements the ASGI specification, you can use any ASGI middleware. A middleware doesn't have to be made for FastAPI o...r Starlette to work, as long as it follows the ASGI spec. In general, ASGI middlewares are classes that expect to receive an ASGI app...UnicornMiddleware app = SomeASGIApp () new_app = UnicornMiddleware ( app , some_config = "rainbow" ) But FastAPI (actually Starlette) provides a simpler way to do it that makes sure that the internal middlewares handle server errors and custom exception h... - https://man.mtool.work/fastapi/0.115/advanced/middleware/
- Response Headers 9822
- Response Headers Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Use a Response parameter You can declare a parameter of type Response in your path operation funct
...guage" : "en-US" } return JSONResponse ( content = content , headers = headers ) Technical Details You could also use from starlette.responses import Response or from starlette.responses import JSONResponse . FastAPI provides the same starlette.responses...as fastapi.responses just as a convenience for you, the developer. But most of the available responses come directly from Starlette. And as the Response can be used frequently to set headers and cookies, FastAPI also provides it at fastapi.Response . Cus...CORS configurations (read more in CORS (Cross-Origin Resource Sharing) ), using the parameter expose_headers documented in Starlette's CORS docs .... - https://man.mtool.work/fastapi/0.115/advanced/response-headers/
- Response Cookies 9745
- Response Cookies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Use a Response parameter You can declare a parameter of type Response in your path operation funct
...sending any data that should have been filtered by a response_model . More info Technical Details You could also use from starlette.responses import Response or from starlette.responses import JSONResponse . FastAPI provides the same starlette.responses...as fastapi.responses just as a convenience for you, the developer. But most of the available responses come directly from Starlette. And as the Response can be used frequently to set headers and cookies, FastAPI also provides it at fastapi.Response . To...see all the available parameters and options, check the documentation in Starlette .... - https://man.mtool.work/fastapi/0.115/advanced/response-cookies/
- Templates 9667
- 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
...other tools. There are utilities to configure it easily that you can use directly in your FastAPI application (provided by Starlette). Install dependencies Make sure you create a virtual environment , activate it, and install jinja2 : $ pip install jinja2...lates . TemplateResponse ( request = request , name = "item.html" , context = { "id" : id } ) Note Before FastAPI 0.108.0, Starlette 0.29.0, the name was the first parameter. Also, before that, in previous versions, the request object was passed as part o...ss=HTMLResponse the docs UI will be able to know that the response will be HTML. Technical Details You could also use from starlette.templating import Jinja2Templates . FastAPI provides the same starlette.templating as fastapi.templating just as a conveni... - https://man.mtool.work/fastapi/0.115/advanced/templates/
- 静的ファイル 8781
- 静的ファイル StaticFiles を使用して、ディレクトリから静的ファイルを自動的に提供できます。 StaticFiles の使用 StaticFiles をインポート。 StaticFiles() インスタンスを生成し、特定のパスに「マウント」。 Python 3.8+ from fastapi import FastAPI f
...aticFiles app = FastAPI () app . mount ( "/static" , StaticFiles ( directory = "static" ), name = "static" ) 技術詳細 from starlette.staticfiles import StaticFiles も使用できます。 FastAPI は、開発者の利便性のために、 starlette.staticfiles と同じ fastapi....staticfiles を提供します。しかし、実際にはStarletteから直接渡されています。 「マウント」とは 「マウント」とは、特定のパスに完全な「独立した」アプリケーションを追加することを意...とは異なる場合があり、独自のアプリケーションのニーズと詳細に合わせて調整します。 より詳しい情報 詳細とオプションについては、 Starletteの静的ファイルに関するドキュメント を確認してください。... - https://man.mtool.work/fastapi/0.115/tutorial/static-files/