Search code examples
djangodjango-manage.py

django manage.py - Is there a way to get the --settings argument from the environment?


Hi I have different instances of the same project that use different settings file, so for each instance I have different argument for manage.py

python manage.py <some_command> --settings=some_settings

And I want to create scrips with different manage.py commands that I can reuse in these different instances and I also want to execute commands by hand.

So, is there a way to have the --settigns=some_settings come from the environment? So I can reuse the scripts and also not have to retype that everytime I call manage.py.

Thanks!!!


Solution

  • Yes. You should use DJANGO_SETTINGS_MODULE environment variable.

    https://docs.djangoproject.com/en/1.8/topics/settings/#designating-the-settings