Project information:
Automated code metrics:
django-click
is a library to easily write Django management commands using the click
command line library.
- Free software: MIT license
- Documentation for the Click command line library: https://click.palletsprojects.com/en/8.0.x/
- Compatible with Django 4.2 and 5.0 running on Python 3.8, 3.9, 3.10, 3.11, and 3.12 (note: 3.10+ required for Django 5.0).
pip install django-click
Create a command module as you would usually do, but instead of creating a class, just put a djclick
command into <yourapp>/management/commands/helloworld.py
:
import djclick as click
@click.command()
@click.argument('name')
def command(name):
click.secho('Hello, {}'.format(name), fg='red')
And then call the command with:
$ ./manage.py helloworld django-click
Hello, django-click
Check out the test commands for additional example commands and advanced usage.