File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ string it will import it) and then look for all uppercase variables
37
37
defined there. In our case, the configuration we just wrote a few lines
38
38
of code above. You can also move that into a separate file.
39
39
40
- Usually, it is a good idea to load a configuration from a configurable
41
- file. This is what :meth: `~flask.Config.from_envvar ` can do, replacing the
42
- :meth: `~flask.Config.from_object ` line above::
43
-
40
+ Usually, it is a good idea to load a separate, environment specific
41
+ configuration file. Flask allows you to import multiple configurations and it
42
+ will use the setting defined in the last import. This enables robust
43
+ configuration setups. :meth: `~flask.Config.from_envvar ` can help achieve this.
44
+
44
45
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
45
46
46
- That way someone can set an environment variable called
47
- :envvar: `FLASKR_SETTINGS ` to specify a config file to be loaded which will then
48
- override the default values. The silent switch just tells Flask to not complain
47
+ Simply define the environment variable :envvar: `FLASKR_SETTINGS ` that points to
48
+ a config file to be loaded. The silent switch just tells Flask to not complain
49
49
if no such environment key is set.
50
50
51
51
The `secret_key ` is needed to keep the client-side sessions secure.
You can’t perform that action at this time.
0 commit comments