Name | django-commands-suite JSON |
Version |
0.2.5
JSON |
| download |
home_page | None |
Summary | A powerful suite of management commands for Django projects with integrated logging support |
upload_time | 2025-09-08 12:36:37 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | MIT |
keywords |
django
commands
management
suite
log
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Django Commands Suite (DCS)
**Django Commands Suite** is a Django app that provides a **powerful suite of management commands** for your projects.
It helps automate repetitive tasks such as:
- Database backup
- Creating superusers quickly
- Seeding fake data
- Cache management
- Logging command executions
- Running custom commands via Web Terminal
---
## Installation
Install via pip:
```bash
pip install django-commands-suite
```
Add it to `INSTALLED_APPS` in your Django settings:
```python
INSTALLED_APPS = [
...
'django_commands_suite',
]
```
Run migrations to create necessary tables:
```bash
python manage.py makemigrations django_commands_suite
python manage.py migrate
```
---
## Usage
### 1. Django Commands
View all DCS commands:
```bash
python manage.py dcs_help
```
Create a superuser quickly:
```bash
python manage.py quick_superuser
```
Backup your database:
```bash
python manage.py backup_db
```
Seed fake data for a model:
```bash
python manage.py dummy_data --model myapp.MyModel --count 10
```
---
### 2. Web Terminal
DCS provides a **Web Terminal** to run commands from the browser:
- URL: `/dcs/terminal/`
- Supports custom DCS commands
- Example commands :
```text
quick_superuser # Creates a superuser
```
---
## Logging
All commands run via DCS (CLI or Web Terminal) are logged automatically using `CommandLog`.
This allows you to keep track of:
- Who ran a command
- When it was run
- Output and status (success or error)
Example usage of logging in a custom command:
```python
from django_commands_suite.utils import log_command
log_command("my_command", {"option": "value"}, "success", "Command output here")
```
---
## Custom DCS Commands
You can define your own commands prefixed with `dcs_` for Web Terminal usage.
Example:
```python
from django.core.management.base import BaseCommand
from django_commands_suite.utils import log_command
class Command(BaseCommand):
help = "Say hello"
def handle(self, *args, **kwargs):
msg = "Hello from DCS!"
self.stdout.write(msg)
log_command("dcs_hello", {}, "success", msg)
```
---
## Utility Function: `run_command`
`run_command` allows you to run any Django management command from code and automatically logs its output and status in `CommandLog`.
### Signature
```python
run_command(command_name: str, *args, **kwargs)
```
### Parameters
- `command_name` (str): Django command name (`"quick_superuser"`, etc.)
- `*args`: Positional arguments for the command
- `**kwargs`: Keyword arguments/options for the command
### Example Usage
```python
from django_commands_suite.utils import run_command
# Run quick_superuser
output = run_command("quick_superuser")
print(output)
```
This function is great for **automation scripts**, **seeders**, or **custom management tasks** in Django projects.
---
## Contributing
Contributions are welcome!
Feel free to:
- Open issues
- Submit pull requests
- Suggest new commands
---
## License
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "django-commands-suite",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django, commands, management, suite, log",
"author": null,
"author_email": "Mohammed taha <net@khamedspace.com>",
"download_url": "https://files.pythonhosted.org/packages/cf/3c/bfd3181bac3feb183bbe102f9d9f2a6d2606a798ee31ebe945b7c4904979/django_commands_suite-0.2.5.tar.gz",
"platform": null,
"description": "# Django Commands Suite (DCS)\r\n\r\n**Django Commands Suite** is a Django app that provides a **powerful suite of management commands** for your projects. \r\nIt helps automate repetitive tasks such as:\r\n\r\n- Database backup\r\n- Creating superusers quickly\r\n- Seeding fake data\r\n- Cache management\r\n- Logging command executions\r\n- Running custom commands via Web Terminal\r\n\r\n---\r\n\r\n## Installation\r\n\r\nInstall via pip:\r\n\r\n```bash\r\npip install django-commands-suite\r\n```\r\n\r\nAdd it to `INSTALLED_APPS` in your Django settings:\r\n\r\n```python\r\nINSTALLED_APPS = [\r\n ...\r\n 'django_commands_suite',\r\n]\r\n```\r\n\r\nRun migrations to create necessary tables:\r\n\r\n```bash\r\npython manage.py makemigrations django_commands_suite\r\npython manage.py migrate\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### 1. Django Commands\r\n\r\nView all DCS commands:\r\n\r\n```bash\r\npython manage.py dcs_help\r\n```\r\n\r\nCreate a superuser quickly:\r\n\r\n```bash\r\npython manage.py quick_superuser\r\n```\r\n\r\nBackup your database:\r\n\r\n```bash\r\npython manage.py backup_db\r\n```\r\n\r\nSeed fake data for a model:\r\n\r\n```bash\r\npython manage.py dummy_data --model myapp.MyModel --count 10\r\n```\r\n\r\n---\r\n\r\n### 2. Web Terminal\r\n\r\nDCS provides a **Web Terminal** to run commands from the browser:\r\n\r\n- URL: `/dcs/terminal/`\r\n- Supports custom DCS commands \r\n- Example commands :\r\n\r\n```text\r\nquick_superuser # Creates a superuser\r\n```\r\n\r\n---\r\n\r\n## Logging\r\n\r\nAll commands run via DCS (CLI or Web Terminal) are logged automatically using `CommandLog`. \r\nThis allows you to keep track of:\r\n\r\n- Who ran a command\r\n- When it was run\r\n- Output and status (success or error)\r\n\r\nExample usage of logging in a custom command:\r\n\r\n```python\r\nfrom django_commands_suite.utils import log_command\r\n\r\nlog_command(\"my_command\", {\"option\": \"value\"}, \"success\", \"Command output here\")\r\n```\r\n\r\n---\r\n\r\n## Custom DCS Commands\r\n\r\nYou can define your own commands prefixed with `dcs_` for Web Terminal usage. \r\nExample:\r\n\r\n```python\r\nfrom django.core.management.base import BaseCommand\r\nfrom django_commands_suite.utils import log_command\r\n\r\nclass Command(BaseCommand):\r\n help = \"Say hello\"\r\n\r\n def handle(self, *args, **kwargs):\r\n msg = \"Hello from DCS!\"\r\n self.stdout.write(msg)\r\n log_command(\"dcs_hello\", {}, \"success\", msg)\r\n```\r\n\r\n---\r\n\r\n## Utility Function: `run_command`\r\n\r\n`run_command` allows you to run any Django management command from code and automatically logs its output and status in `CommandLog`.\r\n\r\n### Signature\r\n\r\n```python\r\nrun_command(command_name: str, *args, **kwargs)\r\n```\r\n\r\n### Parameters\r\n\r\n- `command_name` (str): Django command name (`\"quick_superuser\"`, etc.)\r\n- `*args`: Positional arguments for the command\r\n- `**kwargs`: Keyword arguments/options for the command\r\n\r\n### Example Usage\r\n\r\n```python\r\nfrom django_commands_suite.utils import run_command\r\n\r\n# Run quick_superuser\r\noutput = run_command(\"quick_superuser\")\r\nprint(output)\r\n\r\n```\r\n\r\nThis function is great for **automation scripts**, **seeders**, or **custom management tasks** in Django projects.\r\n\r\n---\r\n\r\n\r\n\r\n\r\n\r\n## Contributing\r\n\r\nContributions are welcome! \r\nFeel free to:\r\n\r\n- Open issues\r\n- Submit pull requests\r\n- Suggest new commands\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT License\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A powerful suite of management commands for Django projects with integrated logging support",
"version": "0.2.5",
"project_urls": {
"homepage": "https://github.com/khamedtaha/django-commands-suite",
"repository": "https://github.com/khamedtaha/django-commands-suite"
},
"split_keywords": [
"django",
" commands",
" management",
" suite",
" log"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d5cc7a5076b9e7cb7555b712b09316d3e2cd163692ba653fd28dc14772741c7a",
"md5": "c88fb6fe1df6e7983fc0f5fe1550dbb8",
"sha256": "337568830e434b4f3983236e8fc74a841c96df89ba76fe0b1ae4310cb4255fa4"
},
"downloads": -1,
"filename": "django_commands_suite-0.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c88fb6fe1df6e7983fc0f5fe1550dbb8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16937,
"upload_time": "2025-09-08T12:36:35",
"upload_time_iso_8601": "2025-09-08T12:36:35.964366Z",
"url": "https://files.pythonhosted.org/packages/d5/cc/7a5076b9e7cb7555b712b09316d3e2cd163692ba653fd28dc14772741c7a/django_commands_suite-0.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cf3cbfd3181bac3feb183bbe102f9d9f2a6d2606a798ee31ebe945b7c4904979",
"md5": "d5bace3fee1a3d0d534127e8a1481cd0",
"sha256": "88b8469bbba665bf04a9ee328f2d25115df05688149832d4a8f8c6866576280b"
},
"downloads": -1,
"filename": "django_commands_suite-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "d5bace3fee1a3d0d534127e8a1481cd0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13316,
"upload_time": "2025-09-08T12:36:37",
"upload_time_iso_8601": "2025-09-08T12:36:37.177548Z",
"url": "https://files.pythonhosted.org/packages/cf/3c/bfd3181bac3feb183bbe102f9d9f2a6d2606a798ee31ebe945b7c4904979/django_commands_suite-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 12:36:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "khamedtaha",
"github_project": "django-commands-suite",
"github_not_found": true,
"lcname": "django-commands-suite"
}