Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Javier Buzzi
Think of it like this, you make a simple settings/base.py where you define something like this: from django.conf import from_env MEDIA_PATH = '/mnt/media' # hardcoded to show you don't have to use ` from_env` DEBUG = from_env.bool('DEBUG') SECRET_KEY = from_env('SECRET_KEY') DATABASES = {

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Bobby Mozumder
If you at least don’t separate all variables that are dependent on the environment from the settings.py, then you’re going to have to edit your settings.py file anyways, defeating the purpose of this. Database and Cache connection settings are clearly dependent on the environment. -bobby > On

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Tom Forbes
A small incremental change with some Django helpers and showing their use in the default settings.py is a great step forward, I would be +1 on that. Tom > On 25 Jun 2020, at 18:52, Kit La Touche wrote: > >  > Wow, `distutils.util.strtobool` is great to know about! > > So, can we refocus

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Kit La Touche
Wow, `distutils.util.strtobool` is great to know about! So, can we refocus this conversation? This is starting to look like previous conversations on this topic, which pull in a lot of possibilities but don't lead to a change. How do we go about generating a DEP or other consensus-building tool

Re: Admin accessibility

2020-06-25 Thread Tom Carrick
I've managed to have a quick look, it looks really promising. Having a total number of issues to compare against would be good to avoid regressions or introducing new issues. I do have one concern. To be viable, it needs to live in the django repo somewhere. And we'd need a full admin site to test

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Javier Buzzi
Hi Bobby, yes, thank you, this looks around the line of what i would like us to implement in Django. Side note: i saw this config('DEBUG', default=False, cast=bool) and thought "there is NO WAY that works", that led me to from distutils.util import strtobool, absolute mind blown! Thanks!

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Bobby Mozumder
There’s also python-decouple that I use that I haven’t seen mentioned in this thread. It lets you set specific environment variables in a separate .env file or INI file: https://github.com/henriquebastos/python-decouple -bobby > On Jun 25, 2020, at 4:47 AM, Javier Buzzi wrote: > > Hey Tom,

Re: Proposal: Drop dependency on pytz in favor of zoneinfo

2020-06-25 Thread Kevin Henry
> The point about the arithmetic semantics is a good one. I'm curious to > know how often this is actually a problem. > That’s an interesting question. I think that doing localized datetime arithmetic in Django is idiomatic, if not necessarily common. Let’s say we have a calendar application

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Javier Buzzi
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.

Re: Making startproject's settings more 12-factor-y

2020-06-25 Thread Tom Carrick
Javier, I just wanted to point out another option for configuration: pydantic - 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