Skip to main content

A Django package which allows specifying custom paths to load managenent commands from.

Project description

Django Custom Commands

A Django package which allows specifying custom paths to load managenent commands from. This allows loading management commands which are not in Django apps.

Installation

pip install django-custom-commands

Usage

There's two things you need to do to use this package:

  1. Import call_command, get_commands and execute_from_command_line from django_custom_commands.management instead of django.core.management.
  2. Define a CUSTOM_COMMAND_LOCATIONS setting in your settings.

The CUSTOM_COMMAND_LOCATIONS should be a list of strings, where each string points to a module where commands can appear. The string should be a dotted path, similar to how apps are defined. The package will then try to load commands from .management.commands in those modules. For example if you have a command in src.demo.management.commands, but you can't/don't want to make src.demo a Django app, you would configure CUSTOM_COMMAND_LOCATIONS = ["src.demo"].

Running tests

poetry run pytest

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

django_custom_commands-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

django_custom_commands-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file django_custom_commands-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django_custom_commands-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97bd7b8a76ef499a8f155784c6b3e41582272479ea44ebe1e57cec8396731ce6
MD5 7f9a02ff04623eb6ebfc41179af650a6
BLAKE2b-256 5fcf6b3dd421e304b8420b0b246794b712d582dfbfd061ea7aa0f05295bffa9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_custom_commands-0.1.0.tar.gz:

Publisher: build.yml on mikicz/django-custom-commands

Attestations:

File details

Details for the file django_custom_commands-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_custom_commands-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76f6e22b953adcac2797dd6d8f4e0c931ee08ad568f2dd114503c5f42cfd311e
MD5 6566c2c1d70377b63368909984cdfe34
BLAKE2b-256 16cbf9f2082ec3ca959c5369b8b838756f96c6d5d1a2d0d33255556c5d7973e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_custom_commands-0.1.0-py3-none-any.whl:

Publisher: build.yml on mikicz/django-custom-commands

Attestations:

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