Skip to content

Commit

Permalink
Merge pull request #16 from joshourisman/v0.4.1
Browse files Browse the repository at this point in the history
v0.4.1
  • Loading branch information
joshourisman committed Apr 7, 2021
2 parents 60a08fb + fa6018b commit 053e086
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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).
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).

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.

Expand Down
4 changes: 2 additions & 2 deletions pydantic_settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class PydanticSettings(BaseSettings):
SESSION_COOKIE_HTTPONLY: Optional[bool] = global_settings.SESSION_COOKIE_HTTPONLY
SESSION_COOKIE_SAMESITE: Optional[
Literal["Lax", "Strict", "None"]
] = global_settings.SESSION_COOKIE_SAMESITE # type: ignore
] = _get_default_setting("SESSION_COOKIE_SAMESITE") # type: ignore
SESSION_SAVE_EVERY_REQUEST: Optional[
bool
] = global_settings.SESSION_SAVE_EVERY_REQUEST
Expand Down Expand Up @@ -258,7 +258,7 @@ class PydanticSettings(BaseSettings):
CSRF_COOKIE_HTTPONLY: Optional[bool] = global_settings.CSRF_COOKIE_HTTPONLY
CSRF_COOKIE_SAMESITE: Optional[
Literal["Lax", "Strict", "None"]
] = global_settings.CSRF_COOKIE_SAMESITE # type: ignore
] = _get_default_setting("CSRF_COOKIE_SAMESITE") # type: ignore
CSRF_HEADER_NAME: Optional[str] = global_settings.CSRF_HEADER_NAME
CSRF_TRUSTED_ORIGINS: Optional[List[str]] = global_settings.CSRF_TRUSTED_ORIGINS
CSRF_USE_SESSIONS: Optional[bool] = global_settings.CSRF_USE_SESSIONS
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-pydantic-settings"
version = "0.4.0"
version = "0.4.1"
description = "Manage Django settings with Pydantic."
authors = ["Josh Ourisman <me@josho.io>"]
license = "MIT"
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@

[tox]
isolated_build = true
envlist = django{22,30,31,32}
envlist = django{20,21,22,30,31,32}

[testenv]
whitelist_extenals = poetry
deps =
pytest
pydantic[email]
django20: Django >=2.0, < 2.1
django21: Django >=2.1, < 2.2
django22: Django >=2.2, < 3.0
django30: Django >=3.0, < 3.1
django31: Django >=3.1, < 3.2
Expand Down

0 comments on commit 053e086

Please sign in to comment.