I recently did a bit of an audit of "settings types" whilst preparing for an overhaul of django-classy-settings.
I found you could cover a majority of the common config types if you could somehow parse from an environ string the following (which closely aligns with django-environ): + str + int + bool + list/tuple<str> + list/tuple<int> + DB Config + Cache Config The complicated ones being DB/Cache configs, and mostly because: - whilst a basic URL suffices, there are lots of optional and sometimes nested options - sqlite in-memory syntax is "special". Alternatively, I've been telling myself for a while now I'd add django-compatible types to confucius, which uses a type annotations approach to env-driven settings. Both support providing __dir__ and __getattr__ so you can plug them "transparently" into your settings.py whilst still benefiting from class features. On Tue, 29 Nov 2022, at 09:20, James Bennett wrote: > It feels like this needs to be a broader conversation about not just > changing DATABASES to accept a URL, or integrating a particular > database-settings project, but to re-think how Django does > settings-from-environment as a whole. > > When I'm setting up new Django-based projects, django-environ > (https://pypi.org/project/django-environ/) is now one of the first > packages I reach for, and it has a much more comprehensive set of > helpers for configuring Django from environment variables and doing > appropriate parsing and type casts. > > There also is Pydantic's settings model > (https://pydantic-docs.helpmanual.io/usage/settings/) which uses type > annotations to drive parsing/validation/type-casting and defaults to > reading from environment variables. > > I'd rather see some sort of comprehensive "make settings-from-env > easier" in Django than one-off pieces like a database URL. > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com > <mailto:django-developers%2bunsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/CAL13Cg-cqJi1JanmhN0S3rf1MYME9qH4XJsCEjLdB5wFXEQeAA%40mail.gmail.com. > -- C -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a2aac2d9-d094-4df3-9b8e-df92ad9e1dc3%40app.fastmail.com.