Skip to main content

Utility for the settings file

Project description

CircleCI Status CodeCov Status

When describing in python of the configuration file, you need to change it in each environment. For example of Django. This package provides the utility to assist it.


$ pip install custom_settings

How to use it


Do the following to use this configuration file.

>>> import custom_settings
>>> custom = custom_settings.load('settings_custom')
>>> custom.get('AUTH_CREDENTIAL')

If you specified type_ argument, convert type to.

>>> custom.get('INTEGER_VALUE', type_=int, default=10)

If you specify True in use_environ, if it does not exist in settings_custom, acquired from the os.environ.

>>> custom.get('PS1', use_environ=True)
'$ '

If you specify default, if it does not exist in settings_custom, to used default.

>>> custom.get('NO_SET_VALUE', default=10)

If you specify True in raise_exception, if it does not exist in settings_custom, raise exception.

>>> custom.get('NO_SET_VALUE', use_environ=True, raise_exception=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/envs/3.5/lib/python3.5/site-packages/custom_settings/", line 40, in get
    raise exc.NoCustomSettingError('Not been set: {}'.format(name))
custom_settings.exc.NoCustomSettingError: Not been set: NO_SET_VALUE

Project details

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
custom_settings-1.0.post1-py3-none-any.whl (8.6 kB) Copy SHA256 hash SHA256 Wheel py3
custom_settings-1.0.post1.tar.gz (5.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

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