Django subcommands in subdirectories
Project description
django-subcommandir
Django subcommands in subdirectories
Installation
$ pip install django-subcommandir
Example of usage
my_app
├── ...
├── management
│ ├── commands
│ │ ├── __init__.py
│ │ ├── load
│ │ │ ├── __init__.py
│ │ │ ├── month_report.py
│ │ │ └── year_report.py
│ │ ├── my_app_load.py
│ ├── __init__.py
# .../management/commands/my_app_load.py
from subcommandir import BaseCommand
class Command(BaseCommand):
subcommand_dir = 'load'
# .../management/commands/load/month_report.py
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--start', ...)
...
def handle(self, *args, **options):
...
Command calls:
$ python manage.py my_app_load year_report
$ python manage.py my_app_load month_report --start="2021-01" --end="2021-02"
or
from django.core.management 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=...)
License
MIT
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
Built Distribution
Close
Hashes for django-subcommandir-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84167572e7e2a0fb503fcee2b12da2ee9096474641c09d60d44f83522a2a2d1d |
|
MD5 | b175b1a5d0781b9e7c507d55d6871d35 |
|
BLAKE2b-256 | d7923a12eb08f9388d1d125e0d081c26df0d106cbf1c791ecfef026571a8cae4 |
Close
Hashes for django_subcommandir-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1559030a594491a73111d148b269e5fee2922afefb8d12f9f30be24a2b3afc31 |
|
MD5 | 9f07059dea8f2354a6132638935569ce |
|
BLAKE2b-256 | 1f80b41fcbeb73382dbf80d08da96acc8314e622481833ee478284dded9f773d |