Django Bash completion not working on manage.py
Question:
I am trying out the django_bash_completion
script provided by Django but can’t use it with python manage.py
command.
I am trying out the django_bash_completion
script provided by Django. I have added it to active script in the virtual environment. It works with django-admin
but can’t use it with python manage.py
command.
cd django-test-project
virtualenv -p python3 venv
echo "source /path/to/.django_bash_completion" >> venv/bin/active
active
django-admin<tab><tab>
python manage.py<tab><tab>
For django-admin
it shows all options like check
, makemigrations
, migrate
runserver
etc but when I run python manage.py
it gives manage.py: command not found
.
Any idea why and how can I solve it?
I am running bash on Ubuntu 18.04
Answers:
You have to run manage.py <tab><tab>
not python manage.py <tab><tab>
As the Official Documentation says: https://docs.djangoproject.com/en/dev/ref/django-admin/#bash-completion
I’ve been using this old original bash-completion for Django. still works 🙂 you don’t need to ./manage.py … try python manage.py [tab]
https://gist.github.com/vigo/5c25936a682845932bdaf17126c4167d
tested on macOS Ventura, python 3.11.0 + Django 4.1.3
I am trying out the django_bash_completion
script provided by Django but can’t use it with python manage.py
command.
I am trying out the django_bash_completion
script provided by Django. I have added it to active script in the virtual environment. It works with django-admin
but can’t use it with python manage.py
command.
cd django-test-project
virtualenv -p python3 venv
echo "source /path/to/.django_bash_completion" >> venv/bin/active
active
django-admin<tab><tab>
python manage.py<tab><tab>
For django-admin
it shows all options like check
, makemigrations
, migrate
runserver
etc but when I run python manage.py
it gives manage.py: command not found
.
Any idea why and how can I solve it?
I am running bash on Ubuntu 18.04
You have to run manage.py <tab><tab>
not python manage.py <tab><tab>
As the Official Documentation says: https://docs.djangoproject.com/en/dev/ref/django-admin/#bash-completion
I’ve been using this old original bash-completion for Django. still works 🙂 you don’t need to ./manage.py … try python manage.py [tab]
https://gist.github.com/vigo/5c25936a682845932bdaf17126c4167d
tested on macOS Ventura, python 3.11.0 + Django 4.1.3