Skip to content

Commit

Permalink
Update README (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsakkas authored Jul 7, 2024
1 parent 8498a34 commit 4b015d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Django Base Settings

[![Latest Release](https://img.shields.io/github/v/release/vsakkas/django-base-settings.svg?color=187f58)](https://github.com/vsakkas/django-base-settings/releases/tag/v0.4.0)
[![Latest Release](https://img.shields.io/github/v/release/vsakkas/django-base-settings.svg?color=187f58)](https://github.com/vsakkas/django-base-settings/releases/tag/v0.4.1)
[![Python](https://img.shields.io/badge/python-3.10+-187f58.svg)](https://www.python.org/downloads/)
[![Django Version](https://img.shields.io/badge/django-5.0+-187f58)](https://www.djangoproject.com/)
[![MIT License](https://img.shields.io/badge/license-MIT-187f58)](https://github.com/vsakkas/django-base-settings/blob/master/LICENSE)
Expand Down Expand Up @@ -70,6 +70,9 @@ CACHES = {
}
```

> [!TIP]
> Import `BaseSettings` and `BaseModel` from `django_base_settings` for your nested configuration objects instead of `pydantic` and `pydantic_settings`. These provide additional useful features such as automatic conversion of lowercase field names to uppercase when creating the Django application settings.
### Environment Variables

Fields contained within DjangoBaseSettings and BaseSettings objects can be assigned values or have their default overwritten through environment variables, providing flexibility for different deployment environments.
Expand All @@ -85,7 +88,7 @@ class MySiteSettings(DjangoBaseSettings):
my_site_settings = MySiteSettings()
```

You can configure the value of default_from_email by creating an environment variable, which will overwrite the default value:
Setting `DEFAULT_FROM_EMAIL` as an environment variable will override the default value of `default_from_email`:

```bash
export DEFAULT_FROM_EMAIL="[email protected]"
Expand All @@ -104,7 +107,15 @@ class MySiteSettings(DjangoBaseSettings):
my_site_settings = MySiteSettings()
```

In this example, setting `DEFAULT_EMAIL` as an environment variable will override the default value of `default_from_email`.
In this example, setting `DEFAULT_EMAIL` as an environment variable will override the default value of `default_from_email`:

```bash
export DEFAULT_EMAIL="[email protected]"
```

### Altering Settings

Django does not recommend altering the application settings during runtime. Because of this, all fields defined using `DjangoBaseSettings` are frozen and cannot be altered after initilization.

## License

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-base-settings"
version = "0.4.0"
version = "0.4.1"
description = "Use Pydantic to enhance your Django application settings."
authors = ["vsakkas <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 4b015d9

Please sign in to comment.