Simple class-based settings for Django
Project description
django-classy-settings
Minimalist approach to class-based settings for Django
https://django-classy-settings.readthedocs.io/en/latest/
Quick Start
In your settings.py
from cbs import BaseSettings, env
...
# For env settings with a DJANGO_ prefix
denv = env['DJANGO_']
class Settings(BaseSettings):
DEBUG = denv.bool(True) # Controlled by DJANGO_DEBUG env var
DEFAULT_DATABASE = denv.dburl('sqlite://db.sqlite')
def DATABASES(self):
return {
'default': self.DEFAULT_DATABASE,
}
class ProdSettings(Settings):
DEBUG = False
@env
def STATIC_ROOT(self):
raise ValueError("Must set STATIC_ROOT!")
__getattr__, __dir__ = BaseSettings.use()
Switch between Settings
and ProdSettings
using the DJANGO_MODE
env var:
# Run default Settings
$ ./manage.py test
# Run ProdSettings
$ DJANGO_MODE=prod ./manage.py test
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
Built Distribution
Close
Hashes for django-classy-settings-3.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f37108b79f3c71a41f5cd08fdacb33d916a1ce6e21b9d3c99c48b7db6cc0b6e |
|
MD5 | 2a5c2d7c360d2ea4765a5149e5f313c4 |
|
BLAKE2b-256 | ff2e85d9a498848e7199b78c0a745b3a261b07a2dff8d7093be73f5ca77303c7 |
Close
Hashes for django_classy_settings-3.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8df8527be5826982acf10aab2c84dadfcc35aaaf903043aceadcaaf25fc3d38 |
|
MD5 | d0a4f0542e9db86a989af81eee0f40d7 |
|
BLAKE2b-256 | ec723f704ea853efd7f5a9a61f23d0bef9412f923817747675d9ce8ccca2d82b |