anze3db/django-tui

Inspect and run Django Commands in a text-based user interface (TUI)

command-line
django
python
textual
tui

django-tui

Inspect and run Django Commands in a text-based user interface (TUI), built with Textual.

PyPI - Version PyPI - Python Version

A demo of django-tui: filtering commands, filling in a command's options and running it, then querying models in the shell

Commands

Type a command and its arguments, like in your shell, or fill in the form. Your project's commands are listed first.

The command screen with the closepoll command and its options

Shell

Run ORM queries with your models and common Django helpers already imported.

The shell with a query and its result

Installation

pip install django-tui

Add "django_tui" to your INSTALLED_APPS setting in settings.py like this:

INSTALLED_APPS = [
    ...,
    "django_tui",
]

Now you can run the TUI with:

python manage.py tui

Type a command at the $ python manage.py prompt at the top, just like in your shell, e.g. migrate myapp --plan. The command name filters the list of commands and the arguments fill in the form below it. Changing the form updates the command too.

Press enter to run the command. It runs inside the TUI's process, so Django doesn't have to start up again for each one. When the command finishes, press enter to go back to the TUI.

Key Action
enter Run the command
↑ ↓ Pick a command from the list
→ Accept the suggested command name
tab Complete the command name and edit its options
ctrl+r Run the command (while editing options)
ctrl+y Copy the command to the clipboard
esc Back to the command line, or clear it
ctrl+j Switch between commands and the shell
ctrl+c Copy the selected text, or press twice to quit

Open the interactive shell directly with python manage.py tui --shell. Press ctrl+r to run your code; the value of the last expression is shown in the output.

Contributing

You need uv and just. just lists the tasks: just check lints and runs the tests, just test-all runs them on every supported Python and Django, and just tui opens the TUI in the test project. just screenshots and just demo save the images above for the next version, in docs/images/<version>/, and point this README at them. Keep the old images: PyPI shows each release's README with that release's images. Releases are described in RELEASING.md.

License

django-tui is distributed under the terms of the MIT license.

Looking for Django Admin in your termain?

Checkout @valberg's django-admin-tui project!

Stars
298
0.67% more than last month
Forks
7
Open Issues
0