Browse Source

formatting

[ci skip]
pull/2366/head
David Lord 8 years ago
parent
commit
01d2f725d3
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 32
      docs/config.rst

32
docs/config.rst

@ -375,15 +375,15 @@ methods on the config object as well to load from individual files. For a
complete reference, read the :class:`~flask.Config` object's complete reference, read the :class:`~flask.Config` object's
documentation. documentation.
Configuring from Environmental Variables Configuring from Environment Variables
---------------------------------------- --------------------------------------
In addition to pointing to configuration files using environment variables, you In addition to pointing to configuration files using environment variables, you
may find it useful (or necessary) to control your configuration values may find it useful (or necessary) to control your configuration values directly
directly from the environment. from the environment.
Environment variables can be set on Linux or OS X with the export command in the Environment variables can be set on Linux or OS X with the export command in
shell before starting the server:: the shell before starting the server::
$ export SECRET_KEY='?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83' $ export SECRET_KEY='?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'
$ export DEBUG=False $ export DEBUG=False
@ -397,10 +397,10 @@ On Windows systems use the `set` builtin instead::
>set DEBUG=False >set DEBUG=False
While this approach is straightforward to use, it is important to remember that While this approach is straightforward to use, it is important to remember that
environment variables are strings -- they are not automatically deserialized into Python environment variables are strings -- they are not automatically deserialized
types. into Python types.
Here is an example of a configuration file that uses environmental variables:: Here is an example of a configuration file that uses environment variables::
# Example configuration # Example configuration
import os import os
@ -415,14 +415,14 @@ Here is an example of a configuration file that uses environmental variables::
raise ValueError("No secret key set for Flask application") raise ValueError("No secret key set for Flask application")
Notice that any value besides an empty string will be interpreted as a boolean True value in Python, which Notice that any value besides an empty string will be interpreted as a boolean
requires care if an environment explicitly sets values intended to be False. ``True`` value in Python, which requires care if an environment explicitly sets
values intended to be ``False``.
Make sure to load the configuration very early on, so that extensions have Make sure to load the configuration very early on, so that extensions have the
the ability to access the configuration when starting up. There are other ability to access the configuration when starting up. There are other methods
methods on the config object as well to load from individual files. For a on the config object as well to load from individual files. For a complete
complete reference, read the :class:`~flask.Config` object's reference, read the :class:`~flask.Config` class documentation.
documentation.
Configuration Best Practices Configuration Best Practices
---------------------------- ----------------------------

Loading…
Cancel
Save