Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Module « flask.cli »

Fonction load_dotenv - module flask.cli

Signature de la fonction load_dotenv

def load_dotenv(path: 'str | os.PathLike[str] | None' = None, load_defaults: 'bool' = True) -> 'bool' 

Description

help(flask.cli.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.

.. _python-dotenv: https://github.com/theskumar/python-dotenv#readme

:param path: Load the file at this location.
:param load_defaults: Search for and load the default ``.flaskenv`` and
    ``.env`` files.
:return: ``True`` if at least one env var was loaded.

.. versionchanged:: 3.1
    Added the ``load_defaults`` parameter. A given path takes precedence
    over default files.

.. versionchanged:: 2.0
    The current directory is not changed to the location of the
    loaded file.

.. versionchanged:: 2.0
    When loading the env files, set the default encoding to UTF-8.

.. versionchanged:: 1.1.0
    Returns ``False`` when python-dotenv is not installed, or when
    the given path isn't a file.

.. versionadded:: 1.0


Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé