コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 3 of about 3 for load (0.002 sec.)
Lifespan Events 10826
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 ... d that are shared among requests, and/or that you need to clean up afterwards. For example, a database connection pool, or loading a shared machine learning model. Use Case Let's start with an example use case and then see how to solve it with this. ... ls are shared among requests, so, it's not one model per request, or one per user or something similar. Let's imagine that loading the model can take quite some time , because it has to read a lot of data from disk . So you don't want to do it for ev ... ery request. You could load it at the top level of the module/file, but that would also mean that it would load the model even if you are just running ...
https://man.mtool.work/fastapi/0.115/advanced/events/
Configure Swagger UI 10380
Configure Swagger UI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can configure some extra Swagger UI parameters . To configure them, pass the swagger_ui_pa ... : True , } def get_swagger_ui_html ( * , openapi_url : Annotated [ str , Doc ( """ The OpenAPI URL that Swagger UI should load and use. This is normally done automatically by FastAPI using the default URL `/openapi.json`. """ ), ], title : Annotated ... tle>` content, normally shown in the browser tab. """ ), ], swagger_js_url : Annotated [ str , Doc ( """ The URL to use to load the Swagger UI JavaScript. It is normally set to a CDN URL. """ ), ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swa ... gger-ui-bundle.js" , swagger_css_url : Annotated [ str , Doc ( """ The URL to use to load the Swagger UI CSS. It is normally set to a CDN URL. """ ), ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui ...
https://man.mtool.work/fastapi/0.115/how-to/configure-swagger-ui/
Custom Docs UI Static Assets (Self-Hosting) 6678
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 ... sage" : f "Hello { username } " } Test it Now, you should be able to go to your docs at http://127.0.0.1:8000/docs , and reload the page, it will load those assets from the new CDN. Self-hosting JavaScript and CSS for docs Self-hosting the JavaScript ... hose static files. Your new file structure could look like this: . ├── app │ ├── __init__.py │ ├── main.py └── static/ Download the files Download the static files needed for the docs and put them on that static/ directory. You can probably right-cli ... est Static Files UI Now, you should be able to disconnect your WiFi, go to your docs at http://127.0.0.1:8000/docs , and reload the page. And even without Internet, you would be able to see the docs for your API and interact with it. ...
https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
PREV 1 NEXT