Carlton—thanks very much for the feedback. Javier—likewise. In particular,
the imagined API you describe above is very appealing to me: start with
`from_env` and then if you learn more about this and want to, add in some
`EnvFileLoader`.

I want to make clear my motivation and agenda here: I have recently had
some conversations with newer devs about their experiences with deployment
of apps they're working on, and with a friend at Heroku about his informal
research into the problems people have with the same. One recurring
friction point (and this is not just on Heroku at all, to be clear) is that
there are a number of things that people *don't know they need to configure*
for a working deployment.

There are four settings that are recurring particular gotchas that people
miss: the secret key, debug, static files, and databases. Static files
seems big and out of scope, databases seems adequately handled by
dj-database-url for most cases, and if your case is more complex, you'll
learn it, but the other two (secret key and debug) seemed easy enough to
flag as "you probably need to configure these!" with this sort of change to
settings. This would be a first step towards shortening the distance from
`startproject` to a working deployment.

Newer devs in particular have, based on my conversations and this friend's
research, been unlikely to (a) know that there are different `startproject`
templates, and (b) feel equipped to choose one, if they do know.

My hope is to make the smallest possible change to just start us moving
towards more clearly flagging, especially for newer devs, "these are things
that will need additional configuration in order to move from 'works on my
machine' to 'deployed'."

Towards that end, I thought that adding a "you might want to get this from
the env" helper would be a clear indication to a new dev that this is a
matter to even consider. Adding other configuration-getting options like
different secret-store file backends seems like a good next step.

Thanks,

--Kit

On Wed, Jun 24, 2020 at 11:13 AM Javier Buzzi <buzzi.jav...@gmail.com>
wrote:

> I looked at the libs that do what we want:
>
> django-configurations - it looks like they use environment variables /
> either via loading them from the environ or a key/value pair file. Having
> classes inside the settings.py might be weird to people.. at the least very
> different.
> confucius - very simplistic, only supports environ and is classed based,
> similar to django-configurations.
> django-environ - supports env file and environ, non-class based.
> dynaconf - supports all kinds of loading options (toml, json, ini,
> environ, .env +) non-class based.
>
> In my opinion, django-environ and dynaconf would be the easiest to sell to
> the community, it would require the least changes/paradigm shifts from how
> everyone is already using django.
>
> Personally, i would really like to see something like this inside my
> settings.py:
>
> from django.conf import from_env  # using standard os.environ
>
> DEBUG = from_env.bool("DEBUG", default=False)
>
> DATABASES = {
>     "default":  from_env.db("DATABASE_URL")  # crash if it cant find it
> }
>
> ...
>
> for more complex examples:
>
> from django.conf import EnvFileLoader
>
> from_env = EnvFileLoader("path/to/.secret")
>
> ...
>
> We can have how ever many loaders we want: toml, json, ini ..
>
> This is both borrowing heavily from dynaconf and django-environ, making
> the fewest changes to how people are accustomed to doing things.
>
> .. what do you guys think?
>
> - Buzzi
>
> --
> 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/41cea044-ffe1-445d-ab7a-a65f69e6d85ao%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/41cea044-ffe1-445d-ab7a-a65f69e6d85ao%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFcS-hDn0AFW4dj_-secrMGq-iWYz-TWKG-vw9%3DVmZ3L6j04aA%40mail.gmail.com.

Reply via email to