django-defaults
Django settings sans boilerplate
Installation
pip install -U django django-defaults
Usage
Updating an existing Django project
defaults.toml
(next to manage.py
) with the following contents:
[django]
settings-module = 'PROJECT_NAME.settings'
routes-module = 'PROJECT_NAME.urls'
This is the compulsory configuration file.
-
settings-module
is similar toDJANGO_SETTINGS_MODULE
-
routes-module
is similar toROOT_URLCONF
settings.py
)
from defaults import emplace
emplace()
This replaces the entirety of the stock settings.py
file, as generated by the django-admin startproject
command.
DJANGO_SETTINGS_MODULE
environment variable is set (in scripts such as manage.py
)
from defaults import setenv
setenv()
This replaces the os.environ.setdefault(DJANGO_SETTINGS_MODULE)
line.
Creating a new Django project
URL=https://github.com/mvasilkov/django-defaults/archive/template.zip
django-admin startproject --template $URL --extension py,toml PROJECT_NAME
See the project template