Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #9

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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