from_envvar() — flask Function Reference
Architecture documentation for the from_envvar() function in config.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 64c4024a_6f73_9984_501a_d823589da302["from_envvar()"] 1e067a59_9e9f_8edb_0434_65b5c5690e36["Config"] 64c4024a_6f73_9984_501a_d823589da302 -->|defined in| 1e067a59_9e9f_8edb_0434_65b5c5690e36 992a2a65_31c4_7dbd_d0e9_54f209631cda["from_pyfile()"] 64c4024a_6f73_9984_501a_d823589da302 -->|calls| 992a2a65_31c4_7dbd_d0e9_54f209631cda style 64c4024a_6f73_9984_501a_d823589da302 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/config.py lines 102–124
def from_envvar(self, variable_name: str, silent: bool = False) -> bool:
"""Loads a configuration from an environment variable pointing to
a configuration file. This is basically just a shortcut with nicer
error messages for this line of code::
app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTINGS'])
:param variable_name: name of the environment variable
:param silent: set to ``True`` if you want silent failure for missing
files.
:return: ``True`` if the file was loaded successfully.
"""
rv = os.environ.get(variable_name)
if not rv:
if silent:
return False
raise RuntimeError(
f"The environment variable {variable_name!r} is not set"
" and as such configuration could not be loaded. Set"
" this variable and make it point to a configuration"
" file"
)
return self.from_pyfile(rv, silent=silent)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does from_envvar() do?
from_envvar() is a function in the flask codebase, defined in src/flask/config.py.
Where is from_envvar() defined?
from_envvar() is defined in src/flask/config.py at line 102.
What does from_envvar() call?
from_envvar() calls 1 function(s): from_pyfile.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free