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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 043e39e56bee751c88ceabf6f4cf4fd54e2635ca195ee09ce1f9ce752900912e |
|
MD5 | 956a003bfe6211c60ec8deb579636abc |
|
BLAKE2b-256 | 3a52208defedd84e9f6063d170540678b31f776945459fefc7ac38dbc521bef2 |
Close
Hashes for django_classy_settings-3.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e48ad17c31902c1e9c245bc88cdba6193110425a1b98127771268a2928f22e3f |
|
MD5 | 62cd05cd6682f736116c27f6d0ac42be |
|
BLAKE2b-256 | 8cbe71c5c09250b77001a41c5ca685b86ba40d0b56c3ee5dd2353db2eee09f06 |