Skip to content

Commit 053e086

Browse files
authored
Merge pull request #16 from joshourisman/v0.4.1
v0.4.1
2 parents 60a08fb + fa6018b commit 053e086

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Use pydantic settings management to simplify configuration of Django settings.
44

5-
Very much a work in progress, but reads the standard DJANGO_SETTINGS_MODULE environment variable (defaulting to pydantic_settings.settings.PydanticSettings) to load a sub-class of pydantic_settings.Settings. All settings (that have been defined in pydantic_settings.Settings) can be overridden with environment variables. A special DatabaseSettings class is used to allow multiple databases to be configured simply with DSNs. In theory, django-pydantic-settings should be compatible with any version of Django that runs on Python 3.6.1+ (which means Django 1.11 and on), but is only tested against officially supported versions (currently 2.2, 3.0, and 3.1).
5+
Very much a work in progress, but reads the standard DJANGO_SETTINGS_MODULE environment variable (defaulting to pydantic_settings.settings.PydanticSettings) to load a sub-class of pydantic_settings.Settings. All settings (that have been defined in pydantic_settings.Settings) can be overridden with environment variables. A special DatabaseSettings class is used to allow multiple databases to be configured simply with DSNs. In theory, django-pydantic-settings should be compatible with any version of Django that runs on Python 3.6.1+ (which means Django 1.11 and on), but is only tested against officially supported versions (currently 2.2, 3.0, 3.1, and 3.2).
66

77
Note: as of django-pydantic-settings 0.4.0, Pydantic 1.8+ is required, which means Python 3.6.1+ is also required. If you need to use Python 3.6, you'll need to stick with django-pydantic-settings <0.4.0.
88

pydantic_settings/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class PydanticSettings(BaseSettings):
216216
SESSION_COOKIE_HTTPONLY: Optional[bool] = global_settings.SESSION_COOKIE_HTTPONLY
217217
SESSION_COOKIE_SAMESITE: Optional[
218218
Literal["Lax", "Strict", "None"]
219-
] = global_settings.SESSION_COOKIE_SAMESITE # type: ignore
219+
] = _get_default_setting("SESSION_COOKIE_SAMESITE") # type: ignore
220220
SESSION_SAVE_EVERY_REQUEST: Optional[
221221
bool
222222
] = global_settings.SESSION_SAVE_EVERY_REQUEST
@@ -258,7 +258,7 @@ class PydanticSettings(BaseSettings):
258258
CSRF_COOKIE_HTTPONLY: Optional[bool] = global_settings.CSRF_COOKIE_HTTPONLY
259259
CSRF_COOKIE_SAMESITE: Optional[
260260
Literal["Lax", "Strict", "None"]
261-
] = global_settings.CSRF_COOKIE_SAMESITE # type: ignore
261+
] = _get_default_setting("CSRF_COOKIE_SAMESITE") # type: ignore
262262
CSRF_HEADER_NAME: Optional[str] = global_settings.CSRF_HEADER_NAME
263263
CSRF_TRUSTED_ORIGINS: Optional[List[str]] = global_settings.CSRF_TRUSTED_ORIGINS
264264
CSRF_USE_SESSIONS: Optional[bool] = global_settings.CSRF_USE_SESSIONS

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-pydantic-settings"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
description = "Manage Django settings with Pydantic."
55
authors = ["Josh Ourisman <me@josho.io>"]
66
license = "MIT"

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
[tox]
77
isolated_build = true
8-
envlist = django{22,30,31,32}
8+
envlist = django{20,21,22,30,31,32}
99

1010
[testenv]
1111
whitelist_extenals = poetry
1212
deps =
1313
pytest
1414
pydantic[email]
15+
django20: Django >=2.0, < 2.1
16+
django21: Django >=2.1, < 2.2
1517
django22: Django >=2.2, < 3.0
1618
django30: Django >=3.0, < 3.1
1719
django31: Django >=3.1, < 3.2

0 commit comments

Comments
 (0)