Giter Site home page Giter Site logo

Comments (2)

jezdez avatar jezdez commented on May 28, 2024

When you use the --settings option, all that Django does is to set the DJANGO_SETTINGS_MODULE environment variable for you (https://github.com/django/django/blob/master/django/core/management/base.py#L42-43)

So this:

./manage.py import_content --settings=project.build_settings

is identical to:

DJANGO_SETTINGS_MODULE=project.build_settings ./manage.py import_content

In other words you can still use that ability to switch between modules. If you use a settings class with the same DJANGO_CONFIGURATION name in each of your settings modules, you should be fine.

That said, I admit this is less than optimal, as you ideally should also be able to set the DJANGO_CONFIGURATION environment variable like the DJANGO_SETTINGS_MODULE variable as a command line option, e.g.:

./manage.py import_content --settings=project.build_settings --configuration=Prod

I'm not completely sure if that use case is the one you're looking for, being able to switch between different settings classes in one module (project/build_settings.py). In my opinion though that should be the goal: having a central settings file that may or may not import setting classes from other modules (for easier code organization) that stores different settings classes (depennding on environments such as Prod, Dev, Test etc) that you can switch between by simply setting the DJANGO_CONFIGURATION environment variable. That's at least how I use it.

I'd be open to adding the ability to also have an optional --configuration command line option for all management commands to set that environment variable like --settings sets DJANGO_SETTINGS_MODULE. What do you think?

from django-configurations.

typeshige avatar typeshige commented on May 28, 2024

Thanks. With django-configurations, I plan to have only one settings file. i.e. I won't need to have projects/build_settings.py, projects/celery_settings.py, etc. anymore. Everything can go inside projects/settings.py as Build, Celery, etc.

So for me, --configuration=Build would suit me just fine.

Thanks!

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.