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.

Files for django-subcommandir, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django_subcommandir-0.1.1-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-subcommandir-0.1.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page