GitXplorerGitXplorer
f

make-management-command

public
9 stars
0 forks
1 issues

Commits

List of commits on branch main.
Unverified
731e3bbed5ee8c37d0bc48633e273fb5c9956b90

Exclude Github images from package

ffrankwiles committed 3 months ago
Unverified
ecc0ec0c0bc1bb65260d140d87616648d2659aaf

Improve README

ffrankwiles committed 3 months ago
Unverified
cf425e5d31adf8838a8c22087851a9dcd8ae1507

Improve README

ffrankwiles committed 3 months ago
Unverified
81f2530e493f2acf4e1b4e994ba7f640157f1bb1

Fix tests

ffrankwiles committed 3 months ago
Unverified
3369cedffa089640b33d7a5b17944d58cf5e91fe

Fix pyproject.toml Python version

ffrankwiles committed 3 months ago
Unverified
0894bb47f105d85bae472ebace6fed6a3c20c211

Remove errant test data

ffrankwiles committed 3 months ago

README

The README file for this repository.

make-management-command

Tests License

Create the proper paths and a base django-click command. Django management commands are a useful and powerful way to make easy-to-use command line tools for your Django project.

However, Django assumes your commands live in Python files in a very specific file system layout relative to your Django app. Specifically, they need to live in <app_name>/management/commands/ and each of these folders needs an empty __init__.py.

Frankly, I'm too old to be bothered to manually create this structure on at least a weekly basis so I built this little utility to do it for me. It will create the paths, empty __init__.py files and X number of very simple django-click commands based on the names I pass as arguments.

Without any arguments, it will simply create the proper path structure for you.

Installation

Install this tool using pip:

pip install https://github.com/frankwiles/make-management-command

Usage

For help, run:

make-management-command --help

Just create the path structure:

make-management-command

Create two commands named foo and bar:

make-management-command foo bar

Screenshot of creating two django management commands

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd make-management-command
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest