Easy configuration for your project
Project description
yzconfig
========
![build](https://travis-ci.org/ykshatroff/yzconfig.svg?branch=master)
Simple application configuration tool for Django (and others)
Summary
-------
`yzconfig` allows you to:
* Define all settings for all of your Django project's applications in one python object (usually, a module)
* Use name prefixes to instantiate the settings object of an application
Usage
-----
`yzconfig` takes an arbitrary object and populates `settings` with values from its attributes whose names
are constructed as `prefix + attr` where `attr` is a `settings` class attribute and `prefix` is given as argument to
`settings` constructor.
An application's settings are defined in a class which inherits from `YzConfig`, then a settings object
is instantiated with the desired prefix:
```python
from yzconfig import YzConfig
class Settings(YzConfig):
VALUE = "default"
_SKIPPED_VALUE = 'skipped'
settings = Settings('TEST_')
```
If your Django settings contain a `TEST_VALUE` property, then the `settings` object's `VALUE` will contain its value,
otherwise it will remain with `"default"`.
Attributes beginning with `_` will not be overwritten.
`yzconfig` can be used with Django or standalone. For the latter case, it's possible to provide a python dotted path
to the settings object in `YZCONFIG_MODULE` environment variable. The default is to import `settings`.
To be used with Django, no extra actions are required.
========
![build](https://travis-ci.org/ykshatroff/yzconfig.svg?branch=master)
Simple application configuration tool for Django (and others)
Summary
-------
`yzconfig` allows you to:
* Define all settings for all of your Django project's applications in one python object (usually, a module)
* Use name prefixes to instantiate the settings object of an application
Usage
-----
`yzconfig` takes an arbitrary object and populates `settings` with values from its attributes whose names
are constructed as `prefix + attr` where `attr` is a `settings` class attribute and `prefix` is given as argument to
`settings` constructor.
An application's settings are defined in a class which inherits from `YzConfig`, then a settings object
is instantiated with the desired prefix:
```python
from yzconfig import YzConfig
class Settings(YzConfig):
VALUE = "default"
_SKIPPED_VALUE = 'skipped'
settings = Settings('TEST_')
```
If your Django settings contain a `TEST_VALUE` property, then the `settings` object's `VALUE` will contain its value,
otherwise it will remain with `"default"`.
Attributes beginning with `_` will not be overwritten.
`yzconfig` can be used with Django or standalone. For the latter case, it's possible to provide a python dotted path
to the settings object in `YZCONFIG_MODULE` environment variable. The default is to import `settings`.
To be used with Django, no extra actions are required.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yzconfig-1.0.tar.gz
(5.2 kB
view details)
Built Distributions
File details
Details for the file yzconfig-1.0.tar.gz
.
File metadata
- Download URL: yzconfig-1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced7b38570977451d17f6415efc355b62e65716fc663c11e8d629b06f366ce4e |
|
MD5 | a54c2ce30144766c686f4b43fa9acce6 |
|
BLAKE2b-256 | 0532a14fc88982667eadb0b9c2f6e19a53c720e9d52bb1413b653ee269e8bf59 |
File details
Details for the file yzconfig-1.0-py3-none-any.whl
.
File metadata
- Download URL: yzconfig-1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3053aa3ac9ee23a0f626fa5117a852acb3eda532153df9e57a99b159991465bf |
|
MD5 | 4b52deab4be4caaae772d3f9af5e221f |
|
BLAKE2b-256 | 4e06b312d8f012d21ae648878408839107be72e36414a8961d49d5bbf74b81e7 |
File details
Details for the file yzconfig-1.0-py2-none-any.whl
.
File metadata
- Download URL: yzconfig-1.0-py2-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94eda32e66402e7a277fc245d61f3ea0699d8a45638046033e469c20dc385989 |
|
MD5 | fb161bf0dd1e8e425ab973c8e543aa82 |
|
BLAKE2b-256 | 9dd2267f016cae84a90b7e363fee1a336bf3b9fd5d12101aae8411bacab62bb9 |