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
File details
Details for the file django-subcommandir-0.3.0.tar.gz
.
File metadata
- Download URL: django-subcommandir-0.3.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e728ee7742979e459998df4dacad11f9ca0122c03aaf4c3c254dc0a401dfcf2 |
|
MD5 | d439080f6d3044e6204bc696e841596c |
|
BLAKE2b-256 | cfe6da6839851d0dcafdd73a44d05b497dd486c3387dd1eeafd504fcdbb7356e |
File details
Details for the file django_subcommandir-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: django_subcommandir-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37e1de71fb1ba677b547d699a871c2a454cec6f533ed7d2af3478a89055282f8 |
|
MD5 | 70d1bcb550f6825b7b0f4918eab7ff22 |
|
BLAKE2b-256 | 4b37ae87ebd47836176e5791357c84dd70c8c9640c925b454c38536c65e36790 |