III Common FastAPI base.
Reason this release was yanked:
Test is over
Project description
III FastAPI Base
Usage
Config
The later config will override the previous one.
This table shows the predefined environment variables.
Keyword | Type | Default | Description |
---|---|---|---|
DEBUG |
boolean | false | To set the logging as DEBUG state. |
RELOAD |
boolean | false | To auto reload the FastAPI application. |
APP_NAME |
string | Backend API | The application name shows on Swagger. |
from pathlib import Path
from api_helper.config import load_config
# Load config
load_config(Path(__file__).parent / ".env")
# Load default config in the directory (.env)
load_config(Path(__file__).parent)
FastAPI example
To config the FastAPI by env, read the Config section.
from pathlib import Path
from api_helper import FastAPI, success_response
app: FastAPI = FastAPI(base_folder=Path(__file__).parent)
# Optional to setup sentry
app.setup_sentry("sentry_dsn")
@app.get("/")
def home():
return success_response("Hello, World!")
# Start the app and enjoy
app.run("127.0.0.1", 5000)
Build backend
hatch
hatch env create
hatch build
hatch publish -r test
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
iii_api_helper-0.0.5.dev0.tar.gz
(16.2 kB
view hashes)
Built Distribution
Close
Hashes for iii_api_helper-0.0.5.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1ca524bd6c0b82a3c519b3558d5bf758600b7e2c28f5a691a262605be841636 |
|
MD5 | 2a4b7f37695c1aaf7e361ef936fbc2be |
|
BLAKE2b-256 | bf61962aec38bee1ab5b8c378517c480c1ccd82e97f3cb953247594789da7368 |
Close
Hashes for iii_api_helper-0.0.5.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e10e398e17df8d3f65cdb4dad2d745d7be121639cda2e7cc20d258bf1574f42 |
|
MD5 | ba274b6a1db13a5c1118eccb9f3666b7 |
|
BLAKE2b-256 | 3ffd897f00d29a98a90d220068c5501c9caa7156a82f8b90d3f890acffe31c67 |