Settings¶
Python Web Extras comes full equipped with extras that can be added into any FastAPI application.
Table of Contents¶
API Settings and Tortoise ORM¶
The package is using FastAPI Utilities under the hood to simplify a lot of the process already built in and adds an extra flavour that allows the clean integration with Tortoise ORM.
If you do not intend to use Tortoise ORM, this setting can be skipped or else it can be found here
How to use¶
In your settings you will need to import the current APISettings class.
Example:
# your_settings.py
from python_web_extras.fastapi.api_settings import APISettings
class Settings(APISettings):
....
FastAPI Utilities recommends
the use of a get_settings() using lru_cache() and this way it would
be simpler to load your enviroment settings in different ways.
A full example is available here.