{"id":13862120,"url":"https://github.com/pythonic-emacs/djangonaut","last_synced_at":"2025-07-14T11:32:30.023Z","repository":{"id":75007025,"uuid":"116883256","full_name":"pythonic-emacs/djangonaut","owner":"pythonic-emacs","description":"Emacs minor mode for Django.","archived":false,"fork":false,"pushed_at":"2025-04-22T23:21:23.000Z","size":3783,"stargazers_count":44,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-23T00:26:22.905Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonic-emacs.png","metadata":{"files":{"readme":"README.markdown","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-09T23:37:07.000Z","updated_at":"2025-04-22T23:21:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"d999c6d6-e898-4ab6-90c0-40d313764887","html_url":"https://github.com/pythonic-emacs/djangonaut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pythonic-emacs/djangonaut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonic-emacs%2Fdjangonaut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonic-emacs%2Fdjangonaut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonic-emacs%2Fdjangonaut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonic-emacs%2Fdjangonaut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonic-emacs","download_url":"https://codeload.github.com/pythonic-emacs/djangonaut/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonic-emacs%2Fdjangonaut/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265285682,"owners_count":23740579,"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":[],"created_at":"2024-08-05T06:01:37.622Z","updated_at":"2025-07-14T11:32:29.615Z","avatar_url":"https://github.com/pythonic-emacs.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# \u003cimg align=\"right\" src=\"pics/django.png\" height=\"150\" width=\"150\"\u003e Djangonaut [![Emacs](https://img.shields.io/badge/Emacs-25-8e44bd.svg)](https://www.gnu.org/software/emacs/) [![Build Status](https://travis-ci.org/proofit404/djangonaut.svg?branch=master)](https://travis-ci.org/proofit404/djangonaut)\n\nEmacs minor mode for Django.\n\n[![MELPA](https://melpa.org/packages/djangonaut-badge.svg)](https://melpa.org/#/djangonaut)\n[![CI](https://github.com/pythonic-emacs/djangonaut/actions/workflows/test.yml/badge.svg)](https://github.com/pythonic-emacs/djangonaut/actions/workflows/test.yml)\n\nThis package is based on the introspection of your Django project.  It\nexecutes Python code to get all necessary information about model,\nviews, and templates inside `INSTALLED_APPS`.  Works the same way for\napplications written by you and for third-party code installed with\n`pip`.\n\nNo more broken code conventions.  No more flaky guesses about your\nproject layout.  If Django can understand it, Djangonaut can\nunderstand it.\n\n## Features\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"pics/find-model-and-view.gif\"\u003e\u003c/div\u003e\n\nDjangonaut mode provides following features\n\n* intelligent navigation in a Django project\n* management commands execution\n* works transparently with vagrant, docker and remote hosts\n\n## Supported Python Versions\n\n2.7, 3.4, 3.5, 3.6\n\n## Supported Django Versions\n\n1.8, 1.9, 1.10, 1.11, 2.0\n\n## Installation\n\nAll you need to do is install the package from\n[Melpa](https://melpa.org/)\n\n    M-x package-install RET djangonaut RET\n\n## Configuration\n\nDjangonaut minor mode available in all buffers related to current\ndjango project (python and html files, dired buffers).  First of all\nenable minor mode:\n\n    M-x global-djangonaut-mode RET\n\nNow you need to configure Emacs environment to run your django\nproject.  For example, `run-python` command should be able to run\ndjango shell.  Emacs require to know three things:\n\n* path to the python interpreter or virtual environment\n* location of the project\n* django settings module of your project\n\n#### Path to the interpreter\n\nDjango itself is a python package you usually install with `pip`.\nIf you install Django into your system globally with `apt` or `yum`\nyou can skip this section.  But most of times python packages are\ninstalled somewhere else like virtual environment on your host, inside\nDocker container or virtual machine orchestrated by Vagrant.\n\nIf you setup project inside virtual environment, use this command to\ntell Emacs where it can find an interpreter:\n\n    M-x pythonic-activate RET /path/to/your/venv/ RET\n\nIf you use Docker or Docker Compose for development, open any of the\nproject files using tramp.  Optionally you can specify interpreter\nlocation inside container.  Also you need to install\n[docker-tramp](https://github.com/emacs-pe/docker-tramp.el) package to\nuse remote interpreter this way.\n\n    C-x C-f /docker:root@container:/app/config/urls.py\n    ;; Optionally...\n    M-x set-variable RET python-shell-interpreter RET \"/usr/local/bin/python\"\n\nIf you use Vagrant for development, first of all add your ssh key to\nthe trusted list in your VM, so you will not be annoyed with password\nprompt pops up frequently.  Then open any project file in the running\nvirtual machine.\n\n    ;; SSH config (done once).\n    ssh-copy-id vagrant@localhost -p 2222\n    ;; Open project file (each time at the begging).\n    C-x C-f /ssh:vagrant@localhost#2222:/app/config/urls.py\n\nOptionally point Emacs to the remote interpreter this way\n\n    M-x set-variable RET python-shell-interpreter RET \"/usr/bin/python\" RET\n\n#### Path to the project\n\nThe key point here - provided python interpreter should be able to\nimport modules from your project.  There is a lot of options here.\nYou can use [setuptools](https://setuptools.readthedocs.io/en/latest/)\nto wrap your project into proper python package and install it into\neditable mode\n\n    pip install -e .\n\nYou can use `pth` file to include project location into interpreter\nimport path\n\n    echo $PWD \u003e venv/lib/python3.7/site-packages/project.pth\n\nOr you can use old plain `PYTHONPATH` environment variable to tell\nEmacs where to look for your project\n\n    M-x set-variable RET python-shell-extra-pythonpaths RET '(\"/path/to/the/project/\")\n\nIn case you use Docker you can also set this variable directly inside\ncontainer either with command line arguments or via\n[environment](https://docs.docker.com/compose/compose-file/) key of\nthe docker compose file\n\n    docker run -e PYTHONPATH=/code/ web django-admin runserver 0.0.0.0:8000\n\n#### Settings module\n\nAlso Emacs needs to know your django settings module.  We can provide\nit the same way as we do with project path via environment variable\n\n    M-x set-variable RET python-shell-process-environment RET '(\"DJANGO_SETTINGS_MODULE=project.settings\")\n\nAnd in the case of docker you can setup this variable inside container\ndirectly or with compose file environment key\n\n    docker run -e DJANGO_SETTINGS_MODULE=project.settings web ...\n\n### Configuration via .dir-locals.el\n\nAnother way to set the above variables is via [directory variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html). The values you set will then be valid when editing all files in the directory where `.dir-locals.el` is located and all directories underneath that one. To set the same values as in the examples above, we would use the following `.dir-locals.el` file:\n\n\t((nil\n\t  (python-shell-process-environment . (\"DJANGO_SETTINGS_MODULE=project.settings\"))\n\t  (python-shell-extra-pythonpaths . (\"/path/to/the/project/\"))\n\t  (python-shell-virtualenv-root . \"/path/to/your/venv/\")))\n\nNote that you should specify `nil` for the major-mode specification in the directory variables, indicating that the values will be valid in all Emacs buffers associated with files under the directory, not just, say, buffers of open Python files.\n\n## Usage\n\nIf you open file or directory related to the project, you should see\n`Django` minor mode is activated for this buffer.  Note, you should\nopen project files over tramp method, if you use remote interpreter.\nFor example, open `/docker:root@container:/code/manage.py` instead of\n`manage.py` on the local host.\n\n#### Project navigation\n\n| Key                  | Command                            |\n|----------------------|------------------------------------|\n| \u003ckbd\u003eC-c ' M\u003c/kbd\u003e   | djangonaut-find-model-manager      |\n| \u003ckbd\u003eC-c ' S\u003c/kbd\u003e   | djangonaut-find-settings-module    |\n| \u003ckbd\u003eC-c ' a\u003c/kbd\u003e   | djangonaut-find-admin-class        |\n| \u003ckbd\u003eC-c ' c\u003c/kbd\u003e   | djangonaut-find-management-command |\n| \u003ckbd\u003eC-c ' h\u003c/kbd\u003e   | djangonaut-find-template-filter    |\n| \u003ckbd\u003eC-c ' g\u003c/kbd\u003e   | djangonaut-find-template-tag       |\n| \u003ckbd\u003eC-c ' i\u003c/kbd\u003e   | djangonaut-dired-installed-apps    |\n| \u003ckbd\u003eC-c ' j\u003c/kbd\u003e   | djangonaut-find-static-file        |\n| \u003ckbd\u003eC-c ' m\u003c/kbd\u003e   | djangonaut-find-model              |\n| \u003ckbd\u003eC-c ' n\u003c/kbd\u003e   | djangonaut-find-migration          |\n| \u003ckbd\u003eC-c ' p\u003c/kbd\u003e   | djangonaut-find-drf-permission     |\n| \u003ckbd\u003eC-c ' q\u003c/kbd\u003e   | djangonaut-find-sql-function       |\n| \u003ckbd\u003eC-c ' r\u003c/kbd\u003e   | djangonaut-find-signal-receiver    |\n| \u003ckbd\u003eC-c ' s\u003c/kbd\u003e   | djangonaut-find-drf-serializer     |\n| \u003ckbd\u003eC-c ' f\u003c/kbd\u003e   | djangonaut-find-form               |\n| \u003ckbd\u003eC-c ' w\u003c/kbd\u003e   | djangonaut-find-widget             |\n| \u003ckbd\u003eC-c ' t\u003c/kbd\u003e   | djangonaut-find-template           |\n| \u003ckbd\u003eC-c ' u\u003c/kbd\u003e   | djangonaut-find-url-module         |\n| \u003ckbd\u003eC-c ' v\u003c/kbd\u003e   | djangonaut-find-view               |\n| \u003ckbd\u003eC-c ' d\u003c/kbd\u003e   | djangonaut-find-middleware         |\n\nAll navigation commands can open definitions in the other window.  For\nexample use \u003ckbd\u003eC-c ' 4 m\u003c/kbd\u003e to open model definition in the other\nwindow.\n\n#### Run management commands\n\nUse \u003ckbd\u003eC-c ' !\u003c/kbd\u003e to run management command in the comint buffer.\nYou can call it with prefix argument `C-u` to set command arguments\nvia interactive menu.\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"pics/run-management-command-popup.gif\"\u003e\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonic-emacs%2Fdjangonaut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonic-emacs%2Fdjangonaut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonic-emacs%2Fdjangonaut/lists"}