load_dotenv
Load "dotenv" files to set environment variables. A given path takes precedence over .env, which takes precedence over .flaskenv. After loading and combining these files, values are only set if the key is not already set in os.environ. This is a no-op if python-dotenv_ is not installed.
def load_dotenv(
path: str | os.PathLike[str] | None = None,
load_defaults: bool = True
) - > bool
Load "dotenv" files to set environment variables. A given path takes precedence over ".env", which takes precedence over ".flaskenv". After loading and combining these files, values are only set if the key is not already set in "os.environ". This is a no-op if python-dotenv is not installed.
Parameters
| Name | Type | Description |
|---|---|---|
| path | `str | os.PathLike[str] |
| load_defaults | bool = True | A boolean indicating whether to search for and load the default ".flaskenv" and ".env" files. |
Returns
| Type | Description |
|---|---|
bool | True if at least one env var was loaded. |