django-class-settings
django-class-settings aims to simplify complicated settings layouts by using classes instead of modules. Some of the benefits of using classes include:
- Real inheritance
- Foolproof settings layouts
- Properties
- Implicit environment variable names
Example
# .env
export DJANGO_SECRET_KEY='*2#fz@c0w5fe8f-'
export DJANGO_DEBUG=true
# manage.py
import os
import sys
import class_settings
from class_settings import env
from django.core.management import execute_from_command_line
if __name__ == '__main__':
env.read_env()
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
os.environ.setdefault('DJANGO_SETTINGS_CLASS', 'MySettings')
class_settings.setup()
execute_from_command_line(sys.argv)
# myproject/settings.py
from class_settings import Settings, env
class MySettings(Settings):
SECRET_KEY = env()
DEBUG = env.bool(default=False)
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
ROOT_URLCONF = 'myproject.urls'
WSGI_APPLICATION = 'myproject.wsgi.application'
Installation
Install it from PyPI with pip:
pip install django-class-settings
Requirements
- Django 1.11+
- Python 3.5+
Resources
- Documentation: https://django-class-settings.readthedocs.io/
- Releases: https://pypi.org/project/django-class-settings/
- Changelog: https://github.com/orlnub123/django-class-settings/blob/master/CHANGELOG.md
- Code: https://github.com/orlnub123/django-class-settings
- License: MIT
Metadata
Release files for django-class-settings 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-class-settings-0.2.0.tar.gz | 9.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_class_settings-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / django-class-settings-0.2.0.tar.gz
| Download URL | django-class-settings-0.2.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d84b2df9130386360f7ef87d79de88dcb2784ff878682aedd29d866fe2dfb48
|
|
BLAKE2b-256 checksum How to use checksums |
b9b68d982c987dd487cdcc53d69306ba4b78064491b8c8fb498c3f4591ed2416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0 CPython/3.8.1 Linux/5.4.6-arch3-1
|
Release files / django_class_settings-0.2.0-py3-none-any.whl
| Download URL | django_class_settings-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87edb69a4077d8badb751f9e02fa68cbe849c1639a33f9ca2e7df8c1b7d3b994
|
|
BLAKE2b-256 checksum How to use checksums |
c7c837dd1d20359a7f2212c004534edfa7bb6f06710933f7cd704b18f322c7cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0 CPython/3.8.1 Linux/5.4.6-arch3-1
|