Skip to main content

The django management decorator package

Project description

Django management command decorator

Small django app to quickly create management commands using a decorating, avoiding writing much boilerplate.

Installation

  • Install this package via pip pip install django_management_command_decorator
  • Add management_command_decorator to your INSTALLED_APPS settings
  • Create a commands.py in your app folder
  • Add the django_management_command decorator to any function in the commands.py

Usage

Create a commands.py in your app, and add the following code:

@django_management_command
def print_command():
    print("Hello World!")

You should then be able to call the function from your shell like a management command:

% python manage.py print_command
Hello World!

Function args will be added like management command parameters:

@django_management_command
def greet(name):
    print(f"Hello {name}!")  # noqa: T201
% python manage.py greet Python
Hello Python!

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

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page