Opened 4 years ago
Closed 4 years ago
#32070 closed New feature (duplicate)
Add option to choose app when running management command
Description ¶
In Django 3.1.2, if two apps have a management command with the same name, Django runs the one which belongs to the app that appears first in INSTALLED_APPS
.
This is not an issue, unless the developer does not want to change the order of INSTALLED_APPS
. In this case the developer has to workaround the conflict by:
- Overriding the management command and placing it inside another app with higher precedence in
INSTALLED_APPS
or
- Changing other parts of the code that would be affected by changing the order of
INSTALLED_APPS
To remove the need for those workarounds, I suggest adding an option to choose which app to use (therefore bypassing the INSTALLED_APPS
order) when running the management command:
python manage.py --app myapp my_management_command
This would make Django run my_management_command
from the app myapp
.
Duplicate of #27189.