Skip to main content
CircleCI Status CodeCov Status

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

Install

$ pip install custom_settings

How to use it

settings_custom.py

AUTH_CREDENTIAL = 'MY_CREDENTIAL'
INTEGER_VALUE = '1'

Do the following to use this configuration file.

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

If you specified type_ argument, convert type to.

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

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)
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/adapters.py", line 40, in get
    raise exc.NoCustomSettingError('Not been set: {}'.format(name))
custom_settings.exc.NoCustomSettingError: Not been set: NO_SET_VALUE

Other

Release files for custom-settings 1.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for custom-settings 1.0.post1
File Size Uploaded
custom_settings-1.0.post1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for custom-settings 1.0.post1
File Interpreter ABI Platform
custom_settings-1.0.post1-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / custom_settings-1.0.post1.tar.gz

Download URL custom_settings-1.0.post1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
602093385c141428676e512d1eab5aca5f942a125ddc44b57b7edc19d87a8789
BLAKE2b-256 checksum
How to use checksums
f943ddf28ee80c7a3c41e9b7473c31025718146ccf293a172c0fff75ecb68ec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / custom_settings-1.0.post1-py3-none-any.whl

Download URL custom_settings-1.0.post1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed2e025dc39e0755eb4cc0aa07fd81fd9a0fd4aed475b5e156232ff78f724fa6
BLAKE2b-256 checksum
How to use checksums
16b10f7ff4ef8ef03a297234528384ed237a2bb8406dbb0b918663017a29c044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.post1 This release

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page