Re: Integrate dj-database-url into Django

2018-07-28 Thread Luke Murphy

I'd love to see native dj-database-url support in Django. I suppose it
would have to support all the back-ends, no? It might lead to confusion
otherwise.

On  0, gw...@fusionbox.com wrote:

  I'd like to approach this as 'support database urls in django', rather
  than 'copy/paste dj-database-url into django'. For postgres (I'm not sure
  about other backends), a database url can be passed directly to psycopg2.
  The postgres connection string format actually supports more features than
  is possible with django's HOST/USER/PORT... style settings. For example,
  you can pass multiple hosts and psycopg2 will attempt to connect to one of
  them: https://paquier.xyz/postgresql-2/postgres-10-multi-host-connstr/.
  Any attempt to parse the url in django will result in a loss of those
  features.
  The only problem I see is that we have to parse the database backend out
  of the url, and you can't pass a url like 'postgis://' to psyscopg2.
  I'd like to be able to do something like:
  DATABASES = {
      'default': {
          'DSN': 'postgres://',
          'ENGINE': 'django.contrib.gis.db.backends.postgis',
      },
  }
  And let psycopg2 handle the DSN.

  --
  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 [1]django-developers+unsubscr...@googlegroups.com.
  To post to this group, send email to
  [2]django-developers@googlegroups.com.
  Visit this group at [3]https://groups.google.com/group/django-developers.
  To view this discussion on the web visit
  
[4]https://groups.google.com/d/msgid/django-developers/38553bb5-59b0-4772-a17a-282f795f1548%40googlegroups.com.
  For more options, visit [5]https://groups.google.com/d/optout.

References

  Visible links
  1. mailto:django-developers+unsubscr...@googlegroups.com
  2. mailto:django-developers@googlegroups.com
  3. https://groups.google.com/group/django-developers
  4. 
https://groups.google.com/d/msgid/django-developers/38553bb5-59b0-4772-a17a-282f795f1548%40googlegroups.com?utm_medium=email&utm_source=footer
  5. https://groups.google.com/d/optout


--
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20180728075639.b6i5dzhund3g2xfv%40lostatsea.lostatsea.
For more options, visit https://groups.google.com/d/optout.


Re: Integrate dj-database-url into Django

2018-07-28 Thread Maciej Urbański
I would agree that DSN support seems like a nicer alternative to just 
copying dj-database-url, because it not only focuses on 12factor 
configuration in enviroment variables, but also enables some additional 
flexibility for the database connection option passing.

As for 12factor, I think https://gist.github.com/telent/9742059 is a good 
read as to why exposing as enviroment variables maybe not the best 
motivation. Having to accommodate settings, like database connection 
information, just so they can be fitted into single string put conveyable 
by enviroment variable is a case in point. We likely can do the same for 
Cache addresses as mentioned previously, although we may end up inventing 
new URI schemes do to that.., but django overall has multitude of other 
options that are not as easy to stringify.

On Friday, 27 July 2018 19:14:12 UTC+2, gw...@fusionbox.com wrote:
>
> I'd like to approach this as 'support database urls in django', rather 
> than 'copy/paste dj-database-url into django'. For postgres (I'm not sure 
> about other backends), a database url can be passed directly to psycopg2. 
> The postgres connection string format actually supports more features than 
> is possible with django's HOST/USER/PORT... style settings. For example, 
> you can pass multiple hosts and psycopg2 will attempt to connect to one of 
> them: https://paquier.xyz/postgresql-2/postgres-10-multi-host-connstr/. 
> Any attempt to parse the url in django will result in a loss of those 
> features.
>
> The only problem I see is that we have to parse the database backend out 
> of the url, and you can't pass a url like 'postgis://' to psyscopg2. 
> I'd like to be able to do something like:
>
> DATABASES = {
> 'default': {
> 'DSN': 'postgres://',
> 'ENGINE': 'django.contrib.gis.db.backends.postgis',
> },
> }
>
> And let psycopg2 handle the DSN.
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1a55cc1c-ba9c-4950-ab94-50da8eec7d06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrate dj-database-url into Django

2018-07-28 Thread Tom Forbes
So in the PR I proposed I only bits I took verbatim from dj-database-url
are the tests. The rest is re-implemented. I think it's a pretty good POC
but I haven't touched it in a while.

In any case we have to implement our own parsing for backends that do not
support passing in a URL to the connection library.

Making postgres skip our parsing step and passing it in directly is an
implementation detail and there are much more important questions around
the API design to answer before this has any chance of being included.

On Sat, 28 Jul 2018, 12:57 Maciej Urbański,  wrote:

> I would agree that DSN support seems like a nicer alternative to just
> copying dj-database-url, because it not only focuses on 12factor
> configuration in enviroment variables, but also enables some additional
> flexibility for the database connection option passing.
>
> As for 12factor, I think https://gist.github.com/telent/9742059 is a good
> read as to why exposing as enviroment variables maybe not the best
> motivation. Having to accommodate settings, like database connection
> information, just so they can be fitted into single string put conveyable
> by enviroment variable is a case in point. We likely can do the same for
> Cache addresses as mentioned previously, although we may end up inventing
> new URI schemes do to that.., but django overall has multitude of other
> options that are not as easy to stringify.
>
> On Friday, 27 July 2018 19:14:12 UTC+2, gw...@fusionbox.com wrote:
>>
>> I'd like to approach this as 'support database urls in django', rather
>> than 'copy/paste dj-database-url into django'. For postgres (I'm not sure
>> about other backends), a database url can be passed directly to psycopg2.
>> The postgres connection string format actually supports more features than
>> is possible with django's HOST/USER/PORT... style settings. For example,
>> you can pass multiple hosts and psycopg2 will attempt to connect to one of
>> them: https://paquier.xyz/postgresql-2/postgres-10-multi-host-connstr/.
>> Any attempt to parse the url in django will result in a loss of those
>> features.
>>
>> The only problem I see is that we have to parse the database backend out
>> of the url, and you can't pass a url like 'postgis://' to psyscopg2.
>> I'd like to be able to do something like:
>>
>> DATABASES = {
>> 'default': {
>> 'DSN': 'postgres://',
>> 'ENGINE': 'django.contrib.gis.db.backends.postgis',
>> },
>> }
>>
>> And let psycopg2 handle the DSN.
>>
> --
> 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 post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/1a55cc1c-ba9c-4950-ab94-50da8eec7d06%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFNZOJMa1xSzBeGUYygG7nxfCVz8jUPNEiSEJhbAqLDTwga9BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fellow Reports - July 2018

2018-07-28 Thread Tim Graham


Week ending July 28, 2018

Triaged

---

https://code.djangoproject.com/ticket/29595 - Allow using timedelta in 
migrations questioner (accepted)

https://code.djangoproject.com/ticket/29603 - dumpdata shouldn't use 
allow_migrate_model (duplicate)

https://code.djangoproject.com/ticket/29605 - Allow EmailValidator to 
accept an address with a human readable prefix (wontfix)

https://code.djangoproject.com/ticket/29606 - Validate the type of 
ALLOWED_HOSTS (accepted)

https://code.djangoproject.com/ticket/29602 - Jinja2's forceescape filter 
doesn't work on Django's safe strings (accepted)

https://code.djangoproject.com/ticket/29607 - Add doc examples of handling 
files and their lifecycles with FileField/models (accepted)

Authored

--

https://github.com/django/django/pull/10230 - Fixed #29595 -- Allowed using 
timedelta in migrations questioner.

Reviewed/committed

--

https://github.com/django/django/pull/10203 - Fixed #29563 -- Added result 
streaming for QuerySet.iterator() on SQLite.

https://github.com/django/django/pull/10216 - Refs #13091 -- Added test for 
commit=False idiom with partial unique_together validation.

https://github.com/django/django/pull/10222 - Fixed #28291, #24726 -- Fixed 
ArrayField with JSONField and RangeFields.
https://github.com/django/django/pull/9188 - Fixed #28659 -- Fixed 
LayerMapping crash with null geometry and unique.

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/516b969c-12de-4655-af43-f0b309e0302d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.