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:
pip install django-commands-suite
Add it to INSTALLED_APPS in your Django settings:
INSTALLED_APPS = [
...
'django_commands_suite',
]
Run migrations to create necessary tables:
python manage.py makemigrations django_commands_suite
python manage.py migrate
Usage
1. Django Commands
View all DCS commands:
python manage.py dcs_help
Create a superuser quickly:
python manage.py quick_superuser
Backup your database:
python manage.py backup_db
Seed fake data for a model:
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 :
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:
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:
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
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
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
Metadata
Release files for django-commands-suite 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_commands_suite-0.2.5.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_commands_suite-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.3 kB
Release files / django_commands_suite-0.2.5.tar.gz
| Download URL | django_commands_suite-0.2.5.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b8469bbba665bf04a9ee328f2d25115df05688149832d4a8f8c6866576280b
|
|
BLAKE2b-256 checksum How to use checksums |
cf3cbfd3181bac3feb183bbe102f9d9f2a6d2606a798ee31ebe945b7c4904979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / django_commands_suite-0.2.5-py3-none-any.whl
| Download URL | django_commands_suite-0.2.5-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
337568830e434b4f3983236e8fc74a841c96df89ba76fe0b1ae4310cb4255fa4
|
|
BLAKE2b-256 checksum How to use checksums |
d5cc7a5076b9e7cb7555b712b09316d3e2cd163692ba653fd28dc14772741c7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|