Reputation: 20658
I've been trying to execute django-admin
from within a LiClipse project using:
projectName = "someProject"
command = 'django-admin startproject ' + projectName
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
and also
subprocess.check_call(shlex.split(command))
But each time I get the error:
FileNotFoundError: [Errno 2] No such file or directory: 'django-admin'
However, when I run the same program from the Linux terminal using python3 main.py
, it works fine.
So I figured it might be because django-admin's path isn't added to PYTHONPATH. I did a locate "django-admin"
to find these paths:
/home/nav/.pyenv/shims/django-admin
/home/nav/.pyenv/shims/django-admin.py
/home/nav/.pyenv/versions/3.8.7/bin/django-admin
/home/nav/.pyenv/versions/3.8.7/bin/django-admin.py
/home/nav/.pyenv/versions/3.8.7/bin/__pycache__/django-admin.cpython-38.pyc
/home/nav/.pyenv/versions/3.8.7/lib/python3.8/site-packages/django/bin/django-admin.py
/home/nav/.pyenv/versions/3.8.7/lib/python3.8/site-packages/django/bin/__pycache__/django-admin.cpython-38.pyc
...but I get the same error when I run the program from within LiClipse.
Does anyone know why this problem is happening and how it can be fixed?
Upvotes: 0
Views: 70