{"id":17341003,"url":"https://github.com/synw/django-term","last_synced_at":"2025-04-14T19:08:10.999Z","repository":{"id":57422327,"uuid":"99434338","full_name":"synw/django-term","owner":"synw","description":"In browser terminal for Django","archived":false,"fork":false,"pushed_at":"2018-01-13T09:56:49.000Z","size":182,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T07:34:13.466Z","etag":null,"topics":["django-instant"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-05T16:24:04.000Z","updated_at":"2022-09-04T10:16:41.000Z","dependencies_parsed_at":"2022-09-12T15:53:33.348Z","dependency_job_id":null,"html_url":"https://github.com/synw/django-term","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synw%2Fdjango-term","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synw%2Fdjango-term/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synw%2Fdjango-term/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synw%2Fdjango-term/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synw","download_url":"https://codeload.github.com/synw/django-term/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248546452,"owners_count":21122322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django-instant"],"created_at":"2024-10-15T15:47:25.603Z","updated_at":"2025-04-14T19:08:10.971Z","avatar_url":"https://github.com/synw.png","language":"JavaScript","readme":"# Django Term\n\nIn browser terminal for Django that enables custom commands\n\n## Install\n\nDependency: [Django Instant](https://github.com/synw/django-instant) \nfor the websockets: [install doc](http://django-instant.readthedocs.io/en/latest/src/install.html)\n\n   ```\n   pip install django-term\n   ```\n\nAdd `\"term\",` to installed apps:\n\nSet the urls\n\n   ```python\n   from instant.views import instant_auth\n   \n   urlpatterns = [\n      url('^terminal/', include('term.urls')),\n      url('^instant/', include('instant.urls')),\n      url('^centrifuge/auth/$', instant_auth, name='instant-auth'),\n   ]\n   ```\n\nAdd to settings.py:\n\n   ```python\n   SITE_SLUG = \"mysite\"\n   INSTANT_SUPERUSER_CHANNELS = [\n    [\"$\" + SITE_SLUG + \"_terminal\", [\"/terminal\"]]\n   ]\n   ```\n\n\nCreate a `templates/instant/handlers/$mysite_terminal.js` whith this content:\n\n   ```django\n   {% include \"term/handlers.js\" %}\n   ```\n\nRun the websockets server and go to `/terminal/`\n\n## Commands\n\nNote: to use the commands from third-party apps your must have these apps installed\n\n`help`: display info about the available commands\n \n`ping`: ping the server\n\n`clear`: clears the screen\n\nFrom [Django Introspection](https://github.com/synw/django-introspection):\n\n`inspect`: gives infos about an app or model. Params: `appname` or `appname.Modelname`: ex: `inspect auth.User`\n\nFrom [Django Dex](https://github.com/synw/django-dex):\n\n`replicatedb`: replicates the 'default' db into a sqlite 'replica' db\n \n## Create a command\n \n Create a `terminal` folder in any app. Create a `commands.py` file inside this directory:\n \n   ```python\n   from term.commands import Command, rprint\n  \n   def run_hello(request, cmd_args):\n      rprint(\"Hello world\")\n    \n   # Args are the command name, the runner function and the help text\n   c1 = Command(\"hello\", run_hello, \"Hello world command\")\n   COMMANDS = [c1]\n   ```\n    \nYour command will be detected at startup and enabled in the terminal\n\nTo debug a command during developement use ` TERM_DEBUG_MODEL = \"mymodel\"`\n\n### Apps that have terminal commands:\n\n[django-introspection](https://github.com/synw/django-introspection): get infos about Django objects\n\n[django-dex](https://github.com/synw/django-dex): database export tools\n\n[django-jobrunner](https://github.com/synw/django-jobrunner): experimental asynchronous jobs runner\n\n## Customize the ui\n\nTo customize the colors use the `terminal/colors.css` template\n\n## Screenshot\n\n![Terminal](https://github.com/synw/django-terminal/blob/master/docs/img/screenshot.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynw%2Fdjango-term","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynw%2Fdjango-term","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynw%2Fdjango-term/lists"}