コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 35 for Application (0.002 sec.)
Sub Applications - Mounts 14401
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" application in a specific path, that ... then takes care of handling everything under that path, with the path operations declared in that sub-application. Top-level application First, create the main, top-level, FastAPI application, and its path operations : Python 3.8+ from ... . 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 is just another standard FastAPI applica ...
https://man.mtool.work/fastapi/0.115/advanced/sub-applications/
Lifespan Events 12396
Lifespan Events Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can define logic (code) that should be executed before the application starts up . This means t ... hat this code will be executed once , before the application starts receiving requests . The same way, you can define logic (code) that should be executed when the application is shut ... , this code will be executed once , after having handled possibly many requests . Because this code is executed before the application starts taking requests, and right after it finishes handling requests, it covers the whole application lifespan (the word ... part of the code. That's what we'll solve, let's load the model before the requests are handled, but only right before the application starts receiving requests, not while the code is being loaded. Lifespan You can define this startup and shutdown logic usi ...
https://man.mtool.work/fastapi/0.115/advanced/events/
Server Workers - Gunicorn と Uvicorn 10725
Server Workers - Gunicorn と Uvicorn 前回のデプロイメントのコンセプトを振り返ってみましょう: セキュリティ - HTTPS 起動時の実行 再起動 レプリケーション(実行中のプロセス数) メモリ 開始前の事前ステップ ここまでのドキュメントのチュートリアルで ... 514 [19515] [INFO] Booting worker with pid: 19515 [19511] [INFO] Started server process [19511] [19511] [INFO] Waiting for application startup. [19511] [INFO] Application startup complete. [19513] [INFO] Started server process [19513] [19513] [INFO] Waiting ... for application startup. [19513] [INFO] Application startup complete. [19514] [INFO] Started server process [19514] [19514] [INFO] Waiting ... for application startup. [19514] [INFO] Application startup complete. [19515] [INFO] Started server process [19515] [19515] [INFO] Waiting ...
https://man.mtool.work/fastapi/0.115/deployment/server-workers/
Async Tests 9277
Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now, ... for example, when you're querying your database asynchronously. Imagine you want to test sending requests to your FastAPI application and then verify that your backend successfully wrote the correct data in the database, while using an async database libra ... n for this, that allows us to specify that some test functions are to be called asynchronously. HTTPX Even if your FastAPI application uses normal def functions instead of async def , it is still an async application underneath. The TestClient does some mag ... ic inside to call the asynchronous FastAPI application in your normal def test functions, using standard pytest. But that magic doesn't work anymore when we're using it inside a ...
https://man.mtool.work/fastapi/0.115/advanced/async-tests/
Additional Responses in OpenAPI 8990
Additional Responses in OpenAPI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Warning This is a rather advanced topic. If you are starting with FastAPI , you mig ... ace is: In the key content , that has as value another JSON object ( dict ) that contains: A key with the media type, e.g. application/json , that contains as value another JSON object, that contains: A key schema , that has as the value the JSON Schema fro ... ference here to the global JSON Schemas in another place in your OpenAPI instead of including it directly. This way, other applications and clients can use those JSON Schemas directly, provide better code generation tools, etc. The generated responses in th ... penAPI for this path operation will be: { "responses" : { "404" : { "description" : "Additional Response" , "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Message" } } } }, "200" : { "description" : "Successful Response" , ...
https://man.mtool.work/fastapi/0.115/advanced/additional-responses/
Behind a Proxy 8704
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 ... that adds an extra path prefix that is not seen by your application. In these cases you can use root_path to configure your application. The root_path is a mechanism provided by the ASGI spe ... 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 that you could declare ... a path at /app in your code, but then, you add a layer on top (the proxy) that would put your FastAPI application under a path like /api/v1 . In this case, the original path /app would actually be served at /api/v1/app . Even though all ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
Extending OpenAPI 8354
Extending OpenAPI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . There are some cases where you might need to modify the generated OpenAPI schema. In this section ... you will see how. The normal process The normal (default) process, is as follows. A FastAPI application (instance) has an .openapi() method that is expected to return the OpenAPI schema. As part of the application object creat ... api.json (or for whatever you set your openapi_url ) is registered. It just returns a JSON response with the result of the application's .openapi() method. By default, what the method .openapi() does is check the property .openapi_schema to see if it has co ... . For example, let's add ReDoc's OpenAPI extension to include a custom logo . Normal FastAPI First, write all your FastAPI application as normally: Python 3.8+ from fastapi import FastAPI from fastapi.openapi.utils import get_openapi app = FastAPI () @app . ...
https://man.mtool.work/fastapi/0.115/how-to/extending-openapi/
Bigger Applications - Multiple Files 8306
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 ... can put everything in a single file. FastAPI provides a convenience tool to structure your application while keeping all the flexibility. Info If you come from Flask, this would be the equivalent of Flask's Blueprints. An exa ... s related to your users separated from the rest of the code, to keep it organized. But it's still part of the same FastAPI application/web API (it's part of the same "Python Package"). You can create the path operations for that module using APIRouter . Imp ... cies and another APIRouter . Dependencies We see that we are going to need some dependencies used in several places of the application. So we put them in their own dependencies module ( app/dependencies.py ). We will now use a simple dependency to read a cu ...
https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
HTTP Basic Auth 8242
HTTP Basic Auth Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For the simplest cases, you can use HTTP Basic Auth. In HTTP Basic Auth, the application expects a ... ername and password. And they send a request with a username johndoe and a password love123 . Then the Python code in your application would be equivalent to something like: if "johndoe" == "stanleyjobson" and "love123" == "swordfish" : ... But right at the ... gs are not the same, thinking that "there's no need to waste more computation comparing the rest of the letters". And your application will say "Incorrect username or password". But then the attackers try with username stanleyjobsox and password love123 . A ... nd your application code does something like: if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish" : ... Python will have to com ...
https://man.mtool.work/fastapi/0.115/advanced/security/http-basic-auth/
Global Dependencies 8004
Global Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For some types of applications you might want to add dependencies to the whole application. Sim ... ilar to the way you can add dependencies to the path operation decorators , you can add them to the FastAPI application. In that case, they will be applied to all the path operations in the application: Python 3.9+ from fastapi import Depends ... e path operations in the app. Dependencies for groups of path operations Later, when reading about how to structure bigger applications ( Bigger Applications - Multiple Files ), possibly with multiple files, you will learn how to declare a single dependenci ...
https://man.mtool.work/fastapi/0.115/tutorial/dependencies/global-dependencies/
PREV 1 2 3 4 NEXT