Is it possible to use Django bash in zsh

terminating Django bash allows you to tabulate the django-admin.py and manage.py commands in bash.

There are autocompletion scripts zshfor django, but they do not work with user commands. One of them is in the oh-my-zsh project .

I also know about bashcompinit, but it does not seem to work with django-admin, creating the following error:

./manage.py Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.autocomplete()
  File "lib/python2.7/site-packages/django/core/management/__init__.py", line 266, in autocomplete
    cwords = os.environ['COMP_WORDS'].split()[1:]
  File "bin/../lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'COMP_WORDS'

Is it possible that Django bash will exit with zsh? Or there is another alternative that would allow the use of custom django admin commands.

+4
source share
1 answer

django_bash_completion - :

--- django_bash_completion.old  2014-12-23 10:41:35.589103686 +0900
+++ django_bash_completion  2014-12-23 10:43:27.224848105 +0900
@@ -33,7 +33,7 @@

 _django_completion()
 {
-    COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
+    COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                    COMP_CWORD=$COMP_CWORD \
                    DJANGO_AUTO_COMPLETE=1 $1 ) )
 }

zsh (zsh-5.0.7 ) env(1). bash ( bash -4.3.30 (1) -release).

+2

Source: https://habr.com/ru/post/1568275/


All Articles