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
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| custom_settings-1.0.post1.tar.gz | 5.7 kB | Without provenance | Details for custom_settings-1.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| custom_settings-1.0.post1-py3-none-any.whl | Python 3 | none | any | Details for custom_settings-1.0.post1-py3-none-any.whl |
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 |
Security for custom-settings 1.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.