An opinionated startup extension for FastAPI.
Project description
FastAPI Startup
An opinionated startup extension for FastAPI.
Usage
from fastapi_startup import FastAPIStartup
app = FastAPIStartup(
site_name="My site",
swagger_favicon_url="https://example.com/favicon.ico",
)
Opinions
This is an opinionated way to start FastAPI:
- No ReDoc.
- Swagger is hosted at the
root_path
. - Swagger UI oAuth2 redirect URL is
/oauth2-redirect
. - Endpoint
/ping
responds with the plain text response "pong". - Mounts static directory at
/static
(default). - Title and site name in Swagger
- Assets (expects these files in the directory
./static/assets
):- Favicon -
favicon.ico
. - Swagger CSS -
swagger-ui.min.css
. - Swagger Bundle JS -
swagger-ui-bundle.min.js
.
- Favicon -
Config
Configure FastAPI as usual. Extra arguments (that can be accessed from app.extra
):
Name | Default | Description |
---|---|---|
site_name |
Swagger UI | Displayed in the Swagger title, with app.title . |
static_dir |
static | Where to mount the static directory. Disabled if value is falsy. |
swagger_css_url |
/assets/swagger-ui.min.css | URL to Swagger UI CSS file. |
swagger_favicon_url |
/assets/favicon.ico | URL to your Favicon. |
swagger_js_url |
/assets/swagger-ui-bundle.min.js | URL to Swagger JS bundle file. |
If the swagger_
arguments starts with a "/" and static is mounted, they will be loaded from "static", else it will be treated as a URL.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi-startup-0.2.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_startup-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15a1091265e06a9b4f83df2e3cefb8aba5ea26c4bc48071f99e02fb2d177e6ba |
|
MD5 | 5eb713fcef1ed6aaa00abe0eda0cbf21 |
|
BLAKE2b-256 | 5d1ae4f9eb2baf1672c753040894642599f25a2245012c09da21d5af2a4d5eea |