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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | abde64aa592b149cfcf86202901e081f69a70dcfd9b3f25a547a90843c7a03c7 |
|
MD5 | 21b9eedc4d7cedaeebc069c38e4e9c4d |
|
BLAKE2b-256 | be1ea99359fe96ce9b28acd532c144ae11d92fea93299874bd3a981d4afbdc86 |
Close
Hashes for django_classy_settings-3.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ab36b3abdce7b83a14054578c201ef2efa17a641c8a15a10f18c6a5545b5388 |
|
MD5 | 796f462e031df516ee11181ba867c011 |
|
BLAKE2b-256 | 48e46364102b8df85f9006e8a4c87f72ab9ae709116ca9bf82039198006a7bad |