Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Helpers for dealing with application settings

Project description


Coolfig is a library to easily write configuration specifications to be fulfilled by various sources.


pip install coolfig


Define your schema:

from coolfig import Settings, Value, types

class DefaultSettings(Settings):
     SECRET_KEY = Value(str)
     DEBUG = Value(types.boolean, default=False)
     DB_URL = Value(types.sqlalchemy_url)
     LOCALES = Value(types.list(str))

Instantiate the configuration with a data provider:

from coolfig import EnvConfig

settings = DefaultSettings(EnvConfig(prefix='MYAPP_'))


if settings.DEBUG:


Django integration

In your file:

from coolfig import EnvConfig, load_django_settings




ROOT_URLCONF = 'testprj.urls'

WSGI_APPLICATION = 'testprj.wsgi.application'

      'BACKEND': 'django.template.backends.django.DjangoTemplates',
      'DIRS': [],
      'APP_DIRS': True,
      'OPTIONS': {
            'context_processors': [

load_django_settings(EnvConfig(), locals())

Then, in each settings submodule of each app, you can define additional setting entries to be added to the main settings object. For example, in testprj/my_custom_app/ you can add the following:

from coolfig import Settings, Value

class AppSettings(Settings):  # The class has to be named AppSettings
   MY_APP_SETTING = Value(str)

Usage is 100% compatible with Django’s settings machinery:

from django.conf import settings



1.0.2 - 2016-03-14

  • Additional bug-fixing.

1.0.1 - 2016-03-14

  • Fixed a bug in AppConfig checking.

1.0.0 - 2016-03-14

  • Added support for Django AppConfig (including custom settings path configured with a settings property on the config class.
  • Officially supporting Django 1.4, 1.5, 1.6, 1.7, 1.8 and 1.9, running on Python 2.7, 3.4 (where Django supports itself supports it) and PyPy.

0.4.0 - 2015-10-05

  • Added support for the CACHES Django settings directive
  • Added support for computed_values
  • Added initial documentation stub

0.3.0 - 2015-07-20

  • Added first-class support for Django
  • Added some more importing shortcuts (EnvConfig, DictConfig, load_django_settings)
  • Added a DictValue value, able to load multiple keys with the same prefix into the same value
  • Added an API to merge different settings schema into an existing object

0.2.0 - 2015-05-31

  • Added a EnvConfig provider
  • Added a dottedpath value type

0.1.0 – 2015-05-30

  • Initial release

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
coolfig-1.0.2-py2-none-any.whl (13.4 kB) Copy SHA256 hash SHA256 Wheel 2.7 Mar 14, 2016
coolfig-1.0.2.tar.gz (11.5 kB) Copy SHA256 hash SHA256 Source None Mar 14, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page