Opened 4 years ago

Closed 4 years ago

#32070 closed New feature (duplicate)

Add option to choose app when running management command

Reported by: Yuri Escalianti Owned by: nobody
Component: Core (Management commands) Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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:

  1. Overriding the management command and placing it inside another app with higher precedence in INSTALLED_APPS

or

  1. 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.

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #27189.

Note: See TracTickets for help on using tickets.
Back to Top