Skip to content
Myr

Minor config documentation fixes (grammar, etc)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adam Zapletal · committed by Armin Ronacher · parent ee5eafa · Browse files · 1 file+7 added−7 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+7 added−7 removed

  • other:+7 added−7 removed

1 file+7 added−7 removed

modified:docs/config.rst+7 added-7 removed
4 unmodified lines
56.. versionadded:: 0.378Applications need some kind of configuration. There are different things9you might want to change. Like toggling debug mode, the secret key and a9you might want to change like toggling debug mode, the secret key, and a10lot of very similar things.1112The way Flask is designed usually requires the configuration to be13available when the application starts up. You can either hardcode the14configuration in the code which for many small applications is not13available when the application starts up. You can hardcode the14configuration in the code, which for many small applications is not15actually that bad, but there are better ways.1617Independent of how you load your config, there is a config object18available which holds the loaded configuration values:
44 unmodified lines
6364Configuring from Files65----------------------6667Configuration becomes more useful if you can configure from a file. And68ideally that file would be outside of the actual application package that67Configuration becomes more useful if you can configure from a file, and68ideally that file would be outside of the actual application package so that69you can install the package with distribute (:ref:`distribute-deployment`)70and still modify that file afterwards.7172So a common pattern is this::
1 unmodified line
74 app = Flask(__name__)75 app.config.from_object('yourapplication.default_settings')76 app.config.from_envvar('YOURAPPLICATION_SETTINGS')7778What this does is first loading the configuration from the78This first loads the configuration from the79`yourapplication.default_settings` module and then overrides the values80with the contents of the file the :envvar:`YOURAPPLICATION_SETTINGS`81environment variable points to. This environment variable can be set on82Linux or OS X with the export command in the shell before starting the
11 unmodified lines
94The configuration files themselves are actual Python files. Only values95in uppercase are actually stored in the config object later on. So make96sure to use uppercase letters for your config keys.9798Here an example configuration file::98Here is an example configuration file::99100 DEBUG = False101 SECRET_KEY = '?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'102
23 unmodified lines