Welcome to coolfig’s documentation!¶
Coolfig is a library to easily write extensible configuration specifications to be fulfilled by various sources, such as config files or environment variables. It was written with the goal to make it easy to apply the twelve-factor methodology.
Coolfig is MIT-licensed. Source code is available on GitHub and packages are distributed through PyPI.
Contents:
Installation¶
Quick start¶
Django integration¶
API documentation¶
Module contents¶
Support for working with different sources of configuration values.
- class DefaultSettings(schema.Settings):
- SECRET_KEY = schema.Value(str) DEBUG = schema.Value(types.boolean, default=False) DB_URL = schema.Value(types.sqlalchemy_url) LOCALES = schema.Value(types.list(str))
- settings = DefaultSettings(
- providers.DictConfig(os.environ, prefix=’MYAPP_’))
-
class
coolfig.
DictConfig
(conf_dict, prefix='')[source]¶ Bases:
coolfig.providers.ConfigurationProvider
Loads configuration values from the passed dictionary.
-
class
coolfig.
Dictionary
(spec)[source]¶ Bases:
coolfig.schema.ValueBase
-
coolfig.
load_django_settings
(provider, static_config, base=<class 'coolfig.django.BaseDjangoSettings'>, apps=None, name=None)[source]¶
-
class
coolfig.
Settings
(config_provider)[source]¶ Bases:
coolfig.schema.SettingsBase
-
class
coolfig.
Value
(type, default=<object object>, key=None)[source]¶ Bases:
coolfig.schema.ValueBase
Submodules¶
coolfig.django module¶
-
class
coolfig.django.
BaseDjangoSettings
(config_provider)[source]¶ Bases:
coolfig.schema.Settings
-
ALLOWED_HOSTS
¶
-
CACHES
¶
-
DATABASES
¶
-
DEBUG
¶
-
LANGUAGE_CODE
¶
-
SECRET_KEY
¶
-
STATIC_URL
¶
-
TIME_ZONE
¶
-
USE_I18N
¶
-
USE_L10N
¶
-
USE_TZ
¶
-
coolfig.providers module¶
-
class
coolfig.providers.
DictConfig
(conf_dict, prefix='')[source]¶ Bases:
coolfig.providers.ConfigurationProvider
Loads configuration values from the passed dictionary.
coolfig.schema module¶
-
class
coolfig.schema.
ComputedValue
(callable, *args, **kwargs)[source]¶ Bases:
coolfig.schema.ValueBase
-
class
coolfig.schema.
DictValue
(type, keytype=<type 'str'>, *args, **kwargs)[source]¶ Bases:
coolfig.schema.Value
-
class
coolfig.schema.
Dictionary
(spec)[source]¶ Bases:
coolfig.schema.ValueBase
-
exception
coolfig.schema.
ImproperlyConfigured
[source]¶ Bases:
exceptions.Exception
Raised when e request for a configuration value cannot be fulfilled.
-
class
coolfig.schema.
Settings
(config_provider)[source]¶ Bases:
coolfig.schema.SettingsBase
-
class
coolfig.schema.
StaticValue
(value)[source]¶ Bases:
coolfig.schema.BoundValue
-
class
coolfig.schema.
Value
(type, default=<object object>, key=None)[source]¶ Bases:
coolfig.schema.ValueBase
-
coolfig.schema.
ref
¶ alias of
coolfig.schema.Reference