Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Django settings sans boilerplate

Project description

django-defaults
===

Django settings sans boilerplate

[GitHub][2] ・ [PyPI][3]

Installation
---

```sh
pip install -U django django-defaults
```

Usage
---

**Updating an existing Django project**

1️⃣ Create a new file named `defaults.toml` (next to `manage.py`) with the following contents:

```toml
[django]
settings-module = 'PROJECT_NAME.settings'
routes-module = 'PROJECT_NAME.urls'
```

This is the compulsory configuration file.

* `settings-module` is similar to `DJANGO_SETTINGS_MODULE`
* `routes-module` is similar to `ROOT_URLCONF`

2️⃣ Inject configuration variables into the current module (typically in `settings.py`)

```python
from defaults import emplace

emplace()
```

This replaces the entirety of the stock `settings.py` file, as generated by the `django-admin startproject` command.

3️⃣ Optional: ensure that the `DJANGO_SETTINGS_MODULE` environment variable is set (in scripts such as `manage.py`)

```python
from defaults import setenv

setenv()
```

This replaces the `os.environ.setdefault(DJANGO_SETTINGS_MODULE)` line.

**Creating a new Django project**

```sh
URL=https://github.com/mvasilkov/django-defaults/archive/template.zip
django-admin startproject --template $URL --extension py,toml PROJECT_NAME
```

See the [project template][1]

[1]: https://github.com/mvasilkov/django-defaults/tree/template
[2]: https://github.com/mvasilkov/django-defaults
[3]: https://pypi.org/project/django-defaults/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-defaults, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-defaults-0.0.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page