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.1.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file fastapi-startup-0.2.1.tar.gz
.
File metadata
- Download URL: fastapi-startup-0.2.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee8f356efaffbafbf18f7547cc325b4b014327d00534183a6edb9b435948c743 |
|
MD5 | 363e733ba99ecf7736383c0834b7cbfe |
|
BLAKE2b-256 | 5d218a0e01f333be2c661043b607a488c9e21a1c968a6208f1152c5495169384 |
File details
Details for the file fastapi_startup-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_startup-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d71dd03ee23e541d215b2f7c96402c68926ce14cf820a6f1fa54125a80eebf92 |
|
MD5 | cc67d1ac0f514736027ab0755662542d |
|
BLAKE2b-256 | a0f2a67e1f9ef86ef303a3cbfde280a5a4331138dd099415e876ffe69837868b |