Hey Tom, cool project haven't heard of it, looks to me more inline with 
validating and converting user input from an api/form. I could really see 
myself using this in my personal projects, however this looks like we'd be 
going back to the class based configuration that im trying to avoid. 
Nonetheless thank you for the share!

- Buzzi

On Thursday, June 25, 2020 at 4:34:11 AM UTC-4, Tom Carrick wrote:
>
> Javier, I just wanted to point out another option for configuration: 
> pydantic <https://pydantic-docs.helpmanual.io/> - it offers a very slick 
> and intuitive interface for settings management across environments, 
> seamless handing of environment variables by using type hints, and so on. I 
> wouldn't recommend it for anything other than large sites with complex 
> configurations, but it does work well for those, once you grapple with how 
> to integrate it with django's settings so they're all exposed as 
> `settings.FOO`, and so on.
>
> I don't think I would want to integrate anything like this into Django 
> proper, but it might deserve a mention in the documentation.
>
> Tom
>
> On Wed, 24 Jun 2020 at 23:52, Javier Buzzi <buzzi...@gmail.com 
> <javascript:>> wrote:
>
>> This makes sense, I have a project that has a lot of settings files that 
>> get activated depending on the value of DJANGO_SETTINGS_MODULE. The 
>> solution i outlined above takes your reservations under consideration, if 
>> you want to use it, great, if not also great -- its a supplement not a 
>> requirement.
>>
>> - Buzzi
>>
>> On Wednesday, June 24, 2020 at 5:24:35 PM UTC-4, Dan Davis wrote:
>>>
>>>  tMost of the world is not as seamless as heroku.  My DevOps won't give 
>>> me any more than a handful of environment variables.  I wanted something 
>>> like DATABASE_URL, but all I have is DJANGO_LOG_DIR and 
>>> DJANGO_SETTINGS_MODULE, and so I need many, many settings files. I think 
>>> that happens a lot, and maybe a common pattern.
>>>
>>> From a 12factor perspective, I would like to get it down to local 
>>> settings (development) and production settings - yet for a lot of users, 
>>> DevOps is not really supporting a full PaaS-like experience any way.
>>>
>>> So - all of this has to be optional, which seems to rule out making it 
>>> part of the starting project template.  For sure, I've got my personal 
>>> template, and work has an on-premise template and a Cloud template as well 
>>> - but the department of developers doesn't always use these.  I find 
>>> databases containing the tables for other projects, long after the models 
>>> and migrations are gone, indicating a start by copy mode.
>>>
>>> On Wed, Jun 24, 2020 at 1:35 PM Kit La Touche <kit...@gmail.com> wrote:
>>>
>>>> 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...@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-d...@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-d...@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
>>>>  
>>>> <https://groups.google.com/d/msgid/django-developers/CAFcS-hDn0AFW4dj_-secrMGq-iWYz-TWKG-vw9%3DVmZ3L6j04aA%40mail.gmail.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-d...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/7ad2c8c1-c829-42ca-8292-46d0850c0e4co%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/7ad2c8c1-c829-42ca-8292-46d0850c0e4co%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/afd2c408-f32f-497e-814d-7c0bf3806cabo%40googlegroups.com.

Reply via email to