A super-charged FastAPI framework for even faster delivery
Project description
fastoo
A powerful framework for dealing with FastAPI apps.
It includes various utilities for building big FastAPI apps, inclding templates and modules.
Quickstart
-m means add default modules
python -m pip install fastoo==0.1.1
fastoo new blog -m
cd blog
uvicorn app:app --reload
Configs
Define configuration profile in init (development, production, testing)
In your apps import get_settings from init
Render templates
consider this
.
├── api
│ ├── __init__.py
│ ├── module.py
│ └── templates.py
├── app.py
├── cli.py
├── config.py
├── __init__.py
├── init.py
├── modules
│ └── auth
│ ├── business.py
│ ├── models.py
│ ├── templates
│ │ └── abc.html
│ └── view.py
└── templates
└── themes
├── back
└── front
└── dingy
└── index.html
imports
from fastoo.api.module import Module
from fastapi import APIRouter
from fastapi import Request
from fastapi import Depends
from typing import Annotated
from pydantic_settings import BaseSettings
from init import get_settings
If we set render_own_templates to True, render_template will look in a folder called templates in the mdoules folder
router = APIRouter(include_in_schema=False)
module = Module(__file__, render_own_templates=True)
@router.get("/login/")
def login(request: Request):
with module.set(request) as m:
return module.render_template("abc.html", {})
This can be overriden using
module = Module(__file__, render_own_templates=True, templates="custom/path")
If you don't want the whole goodies, just call
from fastoo import render_template
...
return render_template("template/path", {}, request, directory="custom/templates/path")
Modules
Modules must contain info.toml like this
[base]
url_prefix = "/auth"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Fastoo-0.1.1.tar.gz
.
File metadata
- Download URL: Fastoo-0.1.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0bbe10c9e4cf25e8783d7e4333119a766718b3b48519be94d9a474cd8d1e17 |
|
MD5 | 91ffdb22f35807902090227b59c49c0f |
|
BLAKE2b-256 | 25b0d42e9373b1c564f7b587718deadf400925f67384f6b7c373e9bf22f25927 |
File details
Details for the file Fastoo-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: Fastoo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43519aa50415f67f447265e904360971d91a32215930dc39bd0c826b65d1af7d |
|
MD5 | 0c6283da589eeb14b2788f61966e4d31 |
|
BLAKE2b-256 | 79e88813a8ea3f4acd81357a25f482d1a763ab7312ad2248a1183414a9cc7468 |