django-click

repository·master·Indexed 43 days ago

https://github.com/django-commons/django-click

A library that allows developers to build Django management commands using the click CLI package. It enables the use of standard click decorators and functions within the Django management command structure.

Tokens
283
Snippets
3
Records
3
Agent score
5%

What's inside django-click

  1. Create a Django management command with django-click

    master

    To create a management command using click, create a file in <yourapp>/management/commands/<command_name>.py. Instead of defining a class, import djclick as click and use standard click decorators (like @click.command(), @click.argument(), etc.) on a function named command.

    Django will then recognize this as a management command that can be invoked via ./manage.py <command_name>.

    import djclick as click
    
    @click.command()
    @click.argument('name')
    def command(name):
        click.secho(f'Hello, {name}', fg='red')