formatting
Before adoption: this commit came in with the history the project adopted, so no landing records it.
[ci skip]
authored by David Lord · committed by David Lord · parent 53ff054 · Browse files · 1 file·+16 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+16 added−16 removed
- other:+16 added−16 removed
Provenance
- Commit
01d2f72- Tree
a2c604f- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
53ff054
1 file changed+16 added−16 removed
modified:docs/config.rst+16 added-16 removed
373 unmodified lines374 methods on the config object as well to load from individual files. For a375 complete reference, read the :class:`~flask.Config` object's376 documentation.377 378-Configuring from Environmental Variables379-----------------------------------------378+Configuring from Environment Variables379+--------------------------------------380 381 In addition to pointing to configuration files using environment variables, you382-may find it useful (or necessary) to control your configuration values383-directly from the environment.382+may find it useful (or necessary) to control your configuration values directly383+from the environment.384 385-Environment variables can be set on Linux or OS X with the export command in the386-shell before starting the server::385+Environment variables can be set on Linux or OS X with the export command in386+the shell before starting the server::387 388 $ export SECRET_KEY='?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'389 $ export DEBUG=False390 $ python run-app.py5 unmodified lines396 >set SECRET_KEY='?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'397 >set DEBUG=False398 399 While this approach is straightforward to use, it is important to remember that400-environment variables are strings -- they are not automatically deserialized into Python401-types.400+environment variables are strings -- they are not automatically deserialized401+into Python types.402 403-Here is an example of a configuration file that uses environmental variables::403+Here is an example of a configuration file that uses environment variables::404 405 # Example configuration406 import os407 6 unmodified lines414 if not SECRET_KEY:415 raise ValueError("No secret key set for Flask application")416 417 418-Notice that any value besides an empty string will be interpreted as a boolean True value in Python, which419-requires care if an environment explicitly sets values intended to be False.418+Notice that any value besides an empty string will be interpreted as a boolean419+``True`` value in Python, which requires care if an environment explicitly sets420+values intended to be ``False``.421 421-Make sure to load the configuration very early on, so that extensions have422-the ability to access the configuration when starting up. There are other423-methods on the config object as well to load from individual files. For a424-complete reference, read the :class:`~flask.Config` object's425-documentation.422+Make sure to load the configuration very early on, so that extensions have the423+ability to access the configuration when starting up. There are other methods424+on the config object as well to load from individual files. For a complete425+reference, read the :class:`~flask.Config` class documentation.426 427 Configuration Best Practices428 ----------------------------429 168 unmodified lines