Skip to main content

Django subcommands in subdirectories

Project description


GitHub Actions PyPI PyPI - Python Version framework - Django PyPI - Django Version PyPI - License

Django subcommands in subdirectories


$ pip install django-subcommandir

Example of usage

├── ...
├── management
│   ├── commands
│      ├──
│      ├── load
│         ├──
│         ├──
│         └──
│      ├──
│   ├──
# .../management/commands/
from subcommandir import BaseCommand

class Command(BaseCommand):
    subcommand_dir = 'load'
# .../management/commands/load/
from import BaseCommand

class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument('--start', ...)

    def handle(self, *args, **options):

Command calls:

$ python my_app_load year_report
$ python my_app_load month_report --start="2021-01" --end="2021-02"


from import call_command

def load_year_report():
    call_command('my_app_load', 'year_report')
def load_month_report():
    call_command('my_app_load', 'month_report', start=...)



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-subcommandir-0.2.0.tar.gz (4.5 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page