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
- Swagger assets:
- Expects a Favicon -
favicon.ico
- in the static directory. - Expects Swagger CSS -
./static/swagger-ui.min.css
- in the static directory. - Expects Swagger JS -
./static/swagger-ui-bundle.min.js
- in the static directory.
- Expects a 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. |
swagger_css_url |
/swagger-ui.min.css | URL to Swagger UI CSS file. |
swagger_favicon_url |
/favicon.ico | URL to your Favicon. |
swagger_js_url |
/swagger-ui-bundle.min.js | URL to Swagger JS bundle file. |
If the swagger_
arguments starts with a "/", 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.1.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_startup-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9437a68c76328b40eda13620da5d50eb307f1147180b6b74e2afe29abcc0802 |
|
MD5 | 4b89dc594a537be42a901854d4bee802 |
|
BLAKE2b-256 | fc43571919597f92e8d3becf0ff791a718c2a24dfdc24d1c673db2a0591e5cfe |