Giter Site home page Giter Site logo

Comments (6)

mauricioabreu avatar mauricioabreu commented on June 7, 2024

I am not answering your question, I know, but I think it would be easier to use https://github.com/kennethreitz/dj-database-url

Why?

Because it handles all your dict values like a URL. And you just need to do:

DATABASES = values.DatabaseURLValue()

And set your environment variable.

from django-configurations.

mauricioabreu avatar mauricioabreu commented on June 7, 2024

It also is written in the docs AFAIK

from django-configurations.

sassman avatar sassman commented on June 7, 2024

i'm totally aware of that. Database url and elastic beanstalk is an own topic (don't ask)

but nevertheless IMO this pointed out issue is basically serios for all kind of values that are kind of "hidden" or wrapped inside of a datastructure like the dict, list or set.

from django-configurations.

mauricioabreu avatar mauricioabreu commented on June 7, 2024

You have a good point. I am reading the source trying to find a reason.

from django-configurations.

sassman avatar sassman commented on June 7, 2024

Currently I play around with a solution for this. Unfortunately IMO it require a conceptual change:

Curretly:
The Configuration class currently is the access point for the values. The setup_values function in conjunction with accessing values thru Configuraiton class makes sure the values are stored and returned to accessors correctly.

The solution:
setup_values push the "name" of the variable from the Configuration class attribute into the value classes as now. But then the values are loaded into the value classes itself and they behave as proxy objects. So whenever a value is accessed directly it will return the wrapped value as the expected type.

Let me show some examples.
currently:

>>> from configurations import values
>>> v = values.Value(environ_name='HOME', environ_prefix='')
>>> v
<Value default: None>

in future:

>>> from configurations import values                                                                                                                                                                                   
>>> v = values.Value(environ_name='HOME', environ_prefix='')
>>> v                                                                                                                                                                                                               
/home/sassman                                                                                                                                                                                                           

It would be very kind if the maintainer can tell me if that direction would be accepted for a merge request or not.

Thanks in Advance

from django-configurations.

mauricioabreu avatar mauricioabreu commented on June 7, 2024

I am very curious about it too. That is a nice catch!

from django-configurations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.