1

I have deployed Django project (coded in Windows) on Ubuntu 18.04 server with gunicorn and nginx. There is a view which call in command line external package executable, located in /home/user/blast/bin/. PATH to package is defined in .profile

export PATH="$PATH:/home/user/ncbi-blast-2.8.1+/bin"

Package PATH is seen in echo $PATH also in my django project virtualenv.

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ka4an/ncbi-blast-2.8.1+/bin

I am able to run package executable in some_script.py in main shell and in django virtualenv like this: subprocess.run("package_executable", shell=True, stdout=log_file, stderr=log_file) and it returns expected output. However, when It is run in active Django app through views.py it returns that package_executable is not found. I found that inside active Django app i have different echo $PATH output, without PATH to my package:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Active Django app is run by the same root user (who - returns same user). I can run my package inside active Django app by providing full path to package executable, but i`m wondering in why Django do not recognize $PATH defined in .profile.

0 Answers0