Re: Integrate dj-database-url into Django

2022-11-29 Thread 'Tobias McNulty' via Django developers (Contributions to Django itself)
I started a forum thread on the settings refactor here: https://forum.djangoproject.com/t/settings-refactor/17352 Regarding the original topic of this thread ( https://code.djangoproject.com/ticket/28236), are we ready to close this as wontfix? I'm okay not proceeding with it (dj-database-url,

Re: Integrate dj-database-url into Django

2022-11-28 Thread Florian Apolloner
The thread that Carlton refers to is https://groups.google.com/g/django-developers/c/q20_Cxske88 -- don't be deterred by the title of it, it really talks about handling settings as well :) I kinda agree with James. I'd like to have a proper answer for handling settings rather then go setting

Re: Integrate dj-database-url into Django

2022-11-28 Thread Carlton Gibson
This must be do-able now. There was some discussion of something along these lines a couple of years ago, with the idea of doing it for GSoC. There was much back-and-forth but no consensus. It has then come up again with Peter's suggestions about making it easier to get to a deployment ready

Re: Integrate dj-database-url into Django

2022-11-28 Thread Curtis Maloney
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 +

Re: Integrate dj-database-url into Django

2022-11-28 Thread James Bennett
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

Re: Integrate dj-database-url into Django

2022-11-28 Thread Carlton Gibson
Hey Tobias. > Could you (or others) provide some examples of the needs this solution doesn't address (not necessarily complete, just to give an idea)? I hadn't seen the other thread this morning when replying to this one. It looks like some of the issues are indeed addressed *but *I was only

Re: Integrate dj-database-url into Django

2022-11-28 Thread 'Tobias McNulty' via Django developers (Contributions to Django itself)
Hi Carlton, Responses inline below: On Mon, Nov 28, 2022, 2:40 AM Carlton Gibson wrote: > Hi Raphael, thanks for picking this up. > > Looking at the history here, particularly the discussion here > https://groups.google.com/g/django-developers/c/UQjpzB39JN0/m/XGqdV8nbBwAJ > but there are

Re: Integrate dj-database-url into Django

2022-11-28 Thread Carlton Gibson
I see you posted afresh in the other thread, addressing some of the points here. C. On Mon, 28 Nov 2022 at 08:39, Carlton Gibson wrote: > Hi Raphael, thanks for picking this up. > > Looking at the history here, particularly the discussion here >

Re: Integrate dj-database-url into Django

2022-11-27 Thread Carlton Gibson
Hi Raphael, thanks for picking this up. Looking at the history here, particularly the discussion here https://groups.google.com/g/django-developers/c/UQjpzB39JN0/m/XGqdV8nbBwAJ but there are others, the reason this hasn't already happened is that if we're going to merge this into core it would be

Re: Integrate dj-database-url into Django

2022-11-27 Thread Raphael G
Alright, I tried to revive Tom Forbe's work on this in https://github.com/django/django/pull/16331 My honest feeling here is that if Django existed just for me, I would really just want to get this pulled in as an option, and trying to increase the scope beyond "given a URL, get a dictionary

Re: Integrate dj-database-url into Django

2018-12-23 Thread Raffaele Salmaso
Hi all, I'm working on https://github.com/django/django/pull/10786 (which is a port of https://pypi.org/project/django-service-urls/ , which is a 'fork/rewrite' of Tom PR). I need to (re)read all these emails to find ideas to improve the PR/package. On Sat, Jul 28, 2018 at 9:44 PM Tom Forbes

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

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

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

Re: Integrate dj-database-url into Django

2018-07-27 Thread gwahl
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

Re: Integrate dj-database-url into Django

2018-02-04 Thread Michael Manfre
On Sun, Feb 4, 2018 at 12:59 PM Tom Forbes wrote: > I had one question that I’m not sure the answer to: for databases I added > the config_from_url to the .base.DatabaseWrapper class inside each built > in adapter. I’ve kind of assumed each third party database would have the >

Re: Integrate dj-database-url into Django

2018-02-04 Thread Tom Forbes
I spent some time working on this today and fixed up my branch that implements this. I think I’ve got a nice API that passes all of the dj-database-url tests. As there is a bit of database-specific shenanigans we have to perform on URLs I added a

Re: Integrate dj-database-url into Django

2017-06-08 Thread Kenneth Reitz
My thoughts are the same as Shai's below. On Monday, May 29, 2017 at 4:00:09 PM UTC-4, Shai Berger wrote: > > If I understand things correctly, registration of new url-schemas to > enable > something like dj-database-url to support 3rd parties should be a trivial > matter; just add an entry

Re: Integrate dj-database-url into Django

2017-05-29 Thread Shai Berger
If I understand things correctly, registration of new url-schemas to enable something like dj-database-url to support 3rd parties should be a trivial matter; just add an entry to some dictionary, with the schema as key, and the dotted-path of the backend as value. IMO, scanning INSTALLED_APPS,

Re: Integrate dj-database-url into Django

2017-05-28 Thread linus
There's also https://github.com/doismellburning/django12factor - and it simplifies all the boilerplate, that is still required in django-environ, into: import django12factorglobals().update(django12factor.factorise()) It would be quite nice if Django supported 12factor configuration natively,

Re: Integrate dj-database-url into Django

2017-05-27 Thread Tim Allen
I've recently been introduced to `django-environ`, a similar library that has additional features to DB connect URLs that we may want to consider: https://github.com/joke2k/django-environ It has the same issue with third party DB engines; for example, I recently issued a PR to include `pyodbc`

Re: Integrate dj-database-url into Django

2017-05-27 Thread Tom Forbes
Edit: DJANGO_SETTINGS_MODULE isn't relative, it will import any arbitrary module you give it. If we accept that then I think we are accepting the risk of imports via an attacker controlling environment variables whilst Django starts up? On Sat, May 27, 2017 at 8:49 PM, Tom Forbes

Re: Integrate dj-database-url into Django

2017-05-27 Thread Tom Forbes
> I'm wary of possible security ramifications: if we do this, changing a configuration value will import an arbitrary module, which could make it easier to run arbitrary code in some scenarios. I don't have a clear threat model in mind here, though. Good point, it's not wise to enable this even

Re: Integrate dj-database-url into Django

2017-05-25 Thread Florian Apolloner
On Thursday, May 25, 2017 at 9:46:56 AM UTC+2, Aymeric Augustin wrote: > > I'm wary of possible security ramifications: if we do this, changing a > configuration value will import an arbitrary module, which could make it > easier to run arbitrary code in some scenarios. I don't have a clear

Re: Integrate dj-database-url into Django

2017-05-25 Thread Aymeric Augustin
Hello, I'm wondering what the exact definition of the URL format is. Is it specified somewhere? Or is it just: [engine]://[username]:[password]@[host]:[port]/[name] where we create arbitrary [engine] values in an ad-hoc fashion? > On 24 May 2017, at 21:21, Tom Forbes wrote:

Re: Integrate dj-database-url into Django

2017-05-24 Thread Tom Forbes
My two cents: connection strings/database URI's are a feature I've sorely missed in Django. Built-in functionality to convert environment variables like DJANGO_DB_DEFAULT (or more generally DJANGO_DB_*key*) into the relevant DATABASE setting would make some deployment situations a lot simpler.

Re: Integrate dj-database-url into Django

2017-05-24 Thread Kenneth Reitz
Ah, I see what you're saying about third-party backends. I imagine that you'd have to be able to merge a url string with a settings dict (one overrides the other). This is how usage of that functionality is manually provided in dj-database-url. -- You received this message because you are

Re: Integrate dj-database-url into Django

2017-05-24 Thread Kenneth Reitz
I don't think the code will be able to be re-used as much as the idea/ux/functionality that it provides. I can imagine any backend being able to convert from a url string with some methods (e.g. `detect_url` (bool return) and `parse_url` (settings dict return type).) Perhaps the same scheme

Re: Integrate dj-database-url into Django

2017-05-24 Thread Florian Apolloner
Hi Kenneth, I think there are a few things to consider before we can merge/reuse dj-database-url. * How are third party backends going to fit into this scheme? * What about other options like CACHES which very much suffers from the same problem. Cheers, Florian -- You received this

Integrate dj-database-url into Django

2017-05-24 Thread Kenneth Reitz
dj-database-url gives Django developers two main things: 1. the ability to represent their database settings via a string (a-la sqlalchemy); very useful for environmnent variables and 12factor apps. 2. it will automatically use the DATABASE_URL environment variable, if present. I'm not sure if