Run Django management commands with a simple `dj {command_name}`. Can also use aliases for commands defined in a simple config file.
Project description
Why?
It is available everywhere if you install via pip, has cute aliases defined in a JSON file (.dj-config.json) per project, will run as many commands as you want, and defaults to Django management commands if an alias cannot be found.
Example .dj-config.json
{
"commands": [
{
"name": "m",
"help": "Does the migration dance",
"execute": "./manage.py makemigrations && ./manage.py migrate",
},
{
"name": "r",
"help": "Runserver",
"execute": "./manage.py runserver",
"long_running": true
}
]
}
Basic arguments and options
dj --helpto see all of the optionsdj --listto see all of the available custom commandsdj {command_name}to run a custom command or Django management command (e.g.dj migrate)dj {command_name} --dry_runto show what commands would run without actually executing them
How to work on the source
- Clone the repo
- Run the source locally:
poetry run python dj - Test the source:
poetry run pytest - Build and install locally:
poetry build && pip3 install --user --upgrade --force-reinstall dist/dj_command-0.1.0-py3-none-any.whl - Test with
~/.local/bin/dj migrate - Publish the source to pypi:
poetry publish --build --username USERNAME --password PASSWORD
Acknowledgements
- poetry: please, please, please continue to wrangle the complexity of 1) creating Python projects, and 2) installing dependencies; seriously, it's baffling out there without you
- click: ridiculously full-featured library to help implement CLI programs in Python; it has all the bells and most of the whistles
- attrs: would you like easy classes in Python? yes, please
- delegator.py: dealing with subprocess is a pain, but delegator hides all the ugly cruft behind a nice API
Prior art
This isn't a new idea and there are a few other implementations out there that do similar things. But, uh, I like mine. 😀
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dj-command-0.2.0.tar.gz.
File metadata
- Download URL: dj-command-0.2.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.6.6 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7abf863d11a6c906fd1be2754a7ac6ed3849539b2e82539f8afb58cd8172bbf5
|
|
| MD5 |
6b9b6b220460dc9d7a030bd84cfbd24c
|
|
| BLAKE2b-256 |
678ef504cacbaee70f0bb2b76d1a7f3430354ee97beebaa9221bcedb5660e5f3
|
File details
Details for the file dj_command-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dj_command-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.6.6 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdcb923040c4d0cf47711fc8dbd2af5f082a6f1659287dc5b9474bed23de97f6
|
|
| MD5 |
46b70ece18aefe6c96a9ba126dfe2f3b
|
|
| BLAKE2b-256 |
0051c4cfe12dbd3367fa24d1d6e330358a97de8e281dc775237d8887a70d15c0
|