Search code examples
pythondjangobash-completiondjango-manage.py

Django Bash completion not working on manage.py


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


Solution

  • 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