In browser terminal for Django

License: MIT

Language: JavaScript

Keywords: django-instant

Django Term

In browser terminal for Django that enables custom commands


Dependency: Django Instant for the websockets: install doc

pip install django-term

Add "term", to installed apps:

Set the urls

from instant.views import instant_auth

urlpatterns = [
   url('^terminal/', include('term.urls')),
   url('^instant/', include('instant.urls')),
   url('^centrifuge/auth/$', instant_auth, name='instant-auth'),

Add to

SITE_SLUG = "mysite"
 ["$" + SITE_SLUG + "_terminal", ["/terminal"]]

Create a templates/instant/handlers/$mysite_terminal.js whith this content:

{% include "term/handlers.js" %}

Run the websockets server and go to /terminal/


Note: to use the commands from third-party apps your must have these apps installed

help: display info about the available commands

ping: ping the server

clear: clears the screen

From Django Introspection:

inspect: gives infos about an app or model. Params: appname or appname.Modelname: ex: inspect auth.User

From Django Dex:

replicatedb: replicates the 'default' db into a sqlite 'replica' db

Create a command

Create a terminal folder in any app. Create a file inside this directory:

from term.commands import Command, rprint

def run_hello(request, cmd_args):
   rprint("Hello world")
# Args are the command name, the runner function and the help text
c1 = Command("hello", run_hello, "Hello world command")

Your command will be detected at startup and enabled in the terminal

To debug a command during developement use TERM_DEBUG_MODEL = "mymodel"

Apps that have terminal commands:

django-introspection: get infos about Django objects

django-dex: database export tools

django-jobrunner: experimental asynchronous jobs runner

Customize the ui

To customize the colors use the terminal/colors.css template



Project Statistics

Sourcerank 4
Repository Size 178 KB
Stars 1
Forks 0
Watchers 2
Open issues 0
Dependencies 4
Contributors 1
Tags 4
Last updated
Last pushed

Top Contributors See all


Packages Referencing this Repo

In browser term for Django
Latest release 0.2.1 - Updated - 1 stars

Recent Tags See all

0.2.1 January 13, 2018
0.2 January 12, 2018
0.1.4 December 10, 2017
0.1 December 10, 2017

Something wrong with this page? Make a suggestion

Last synced: 2018-03-26 16:23:53 UTC

Login to resync this repository