# 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
```bash
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
```bash
poetry run pytest
```
Raw data
{
"_id": null,
"home_page": "https://github.com/mikicz/django-custom-commands",
"name": "django-custom-commands",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "django, commands",
"author": "Mikul\u00e1\u0161 Poul",
"author_email": "mikulaspoul@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5f/cf/6b3dd421e304b8420b0b246794b712d582dfbfd061ea7aa0f05295bffa9f/django_custom_commands-0.1.0.tar.gz",
"platform": null,
"description": "# Django Custom Commands\n\nA Django package which allows specifying custom paths to load managenent commands from. This allows loading management commands which are not in Django apps.\n\n## Installation\n\n```bash\npip install django-custom-commands\n```\n\n## Usage\n\nThere's two things you need to do to use this package:\n1. Import `call_command`, `get_commands` and `execute_from_command_line` from `django_custom_commands.management` instead of `django.core.management`.\n2. Define a `CUSTOM_COMMAND_LOCATIONS` setting in your settings.\n\nThe `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\"]`.\n\n## Running tests\n\n```bash\npoetry run pytest\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Django package which allows specifying custom paths to load managenent commands from.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/mikicz/django-custom-commands",
"Repository": "https://github.com/mikicz/django-custom-commands"
},
"split_keywords": [
"django",
" commands"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "16cbf9f2082ec3ca959c5369b8b838756f96c6d5d1a2d0d33255556c5d7973e8",
"md5": "6566c2c1d70377b63368909984cdfe34",
"sha256": "76f6e22b953adcac2797dd6d8f4e0c931ee08ad568f2dd114503c5f42cfd311e"
},
"downloads": -1,
"filename": "django_custom_commands-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6566c2c1d70377b63368909984cdfe34",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 5131,
"upload_time": "2024-10-30T13:31:35",
"upload_time_iso_8601": "2024-10-30T13:31:35.493388Z",
"url": "https://files.pythonhosted.org/packages/16/cb/f9f2082ec3ca959c5369b8b838756f96c6d5d1a2d0d33255556c5d7973e8/django_custom_commands-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5fcf6b3dd421e304b8420b0b246794b712d582dfbfd061ea7aa0f05295bffa9f",
"md5": "7f9a02ff04623eb6ebfc41179af650a6",
"sha256": "97bd7b8a76ef499a8f155784c6b3e41582272479ea44ebe1e57cec8396731ce6"
},
"downloads": -1,
"filename": "django_custom_commands-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "7f9a02ff04623eb6ebfc41179af650a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 4050,
"upload_time": "2024-10-30T13:31:37",
"upload_time_iso_8601": "2024-10-30T13:31:37.378054Z",
"url": "https://files.pythonhosted.org/packages/5f/cf/6b3dd421e304b8420b0b246794b712d582dfbfd061ea7aa0f05295bffa9f/django_custom_commands-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 13:31:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mikicz",
"github_project": "django-custom-commands",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-custom-commands"
}