Aug. 13, 2024

Django: create sub-commands within a management command

argparse, the standard library module that Django uses for parsing command line options, supports sub-commands. These are pretty neat for providing an expansive API without hundreds of individual commands. Hereโ€™s an example of using sub-commands in a Django management command:

from django.core.management.base import BaseCommand


class Command โ€ฆ