You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-11Lines changed: 27 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,36 @@
5
5
`dj-toml-settings` reads settings from a TOML file. By default, both `pyproject.toml` and `django.toml` files are parsed for settings in the `[tool.django]` namespace.
# These settings are included when `ENVIRONMENT` environment variable is "development"
28
+
[tool.django.envs.development]
29
+
DEBUG = false
30
+
ALLOWED_HOSTS = [
31
+
"example.localhost",
32
+
]
33
+
34
+
# These settings are included when `ENVIRONMENT` environment variable is "production"
35
+
[tool.django.envs.production]
36
+
DEBUG = false
37
+
ALLOWED_HOSTS = { insert = "example.com" }
13
38
```
14
39
15
40
## Features 🤩
@@ -19,7 +44,6 @@ ALLOWED_HOSTS = [
19
44
Use `${SOME_VARIABLE_NAME}` to use an existing setting as a value.
20
45
21
46
```toml
22
-
# pyproject.toml
23
47
[tool.django]
24
48
GOOD_IPS = ["127.0.0.1"]
25
49
ALLOWED_HOSTS = ${GOOD_IPS}
@@ -30,10 +54,6 @@ ALLOWED_HOSTS = ${GOOD_IPS}
30
54
`[tool.django.apps.{ANY_NAME_HERE}]` sections of the TOML file can be used to group settings together. They can be named anything. They will override any settings in `[tool.django]`.
The `[tool.django.envs.{ENVIRONMENT_NAME}]` section of the TOML file will be used when `{ENVIRONMENT_NAME}` is set to the `ENVIRONMENT` environment variable. For example, `ENVIRONMENT=production python manage.py runserver` will load all settings in the `[tool.django.envs.production]` section. There settings will override any settings in `[tool.django.apps.*]` or `[tool.django]`.
0 commit comments