Browse Source

Add note about instantiation to config.Config.from_object

pull/2854/head
Douglas Thor 7 years ago
parent
commit
d62222595a
  1. 8
      flask/config.py

8
flask/config.py

@ -156,6 +156,14 @@ class Config(dict):
from yourapplication import default_config from yourapplication import default_config
app.config.from_object(default_config) app.config.from_object(default_config)
Note that the object is *not* called / instantiated. If you need to
use an attribute of the object instance, such as an @property,
then instantiate the object manually before sending to this function::
my_obj = DefaultConfig()
app.config.from_object(my_obj)
app.config.from_object(DifferentConfig())
You should not use this function to load the actual configuration but You should not use this function to load the actual configuration but
rather configuration defaults. The actual config should be loaded rather configuration defaults. The actual config should be loaded
with :meth:`from_pyfile` and ideally from a location not within the with :meth:`from_pyfile` and ideally from a location not within the

Loading…
Cancel
Save