Comments (2)
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.
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)
- Use the 'furo' theme for Sphinx documentation
- Improve code blocks in documentation
- Release minor version 2.4.1 HOT 3
- 2.4.1: pytest is failing HOT 2
- Replace deprecated imp module with importlib HOT 4
- How can this be used with `django.setup()` HOT 2
- Make magical importing optional
- <frozen importlib._bootstrap>:1049: ImportWarning: ConfigurationImporter.find_spec() not found; falling back to find_module() HOT 4
- "STATICFILES_STORAGE/STORAGES are mutually exclusive" on Django>=4.2
- WSGI application loaded twice unexpectedly
- Release 2.4.2 is not on PyPI HOT 9
- Update Python and Django supported versions
- Add support for Python 3.12 HOT 1
- DeprecationWarning for USE_DEPRECATED_PYTZ, CSRF_COOKIE_MASKED, USE_L10N
- Broken link in `Configuration.load_dotenv` docstring HOT 1
- Add Django 5.0 classifier
- Publish version 2.5.1 on PyPi HOT 2
- Values not working in DATABASES dictionary and values.Value returning Value instance type instead of a str HOT 1
- DOTENV - Using environ_name strange behevior HOT 1
- 2.5.1: documentation build fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-configurations.