|
|
|
@ -143,10 +143,12 @@ class Config(dict):
|
|
|
|
|
- a string: in this case the object with that name will be imported |
|
|
|
|
- an actual object reference: that object is used directly |
|
|
|
|
|
|
|
|
|
Objects are usually either modules or classes. |
|
|
|
|
Objects are usually either modules or classes. :meth:`from_object` |
|
|
|
|
loads only the uppercase attributes of the module/class. A ``dict`` |
|
|
|
|
object will not work with :meth:`from_object` because the keys of a |
|
|
|
|
``dict`` are not attributes of the ``dict`` class. |
|
|
|
|
|
|
|
|
|
Just the uppercase variables in that object are stored in the config. |
|
|
|
|
Example usage:: |
|
|
|
|
Example of module-based configuration:: |
|
|
|
|
|
|
|
|
|
app.config.from_object('yourapplication.default_config') |
|
|
|
|
from yourapplication import default_config |
|
|
|
@ -157,6 +159,9 @@ class Config(dict):
|
|
|
|
|
with :meth:`from_pyfile` and ideally from a location not within the |
|
|
|
|
package because the package might be installed system wide. |
|
|
|
|
|
|
|
|
|
See :ref:`config-dev-prod` for an example of class-based configuration |
|
|
|
|
using :meth:`from_object`. |
|
|
|
|
|
|
|
|
|
:param obj: an import name or object |
|
|
|
|
""" |
|
|
|
|
if isinstance(obj, string_types): |
|
|
|
|