[Answer]-Python System Call Cannot Find File, Error Running on Apache Server


Your approach currently does not make sense:
os.system creates a child process of the WSGI process, while the environment of the parent is passed on to the child, the environment of the child is not passed back/shared with the parent.

Also, source is not a binary, but a built-in function of the shell itself.
If you want to set environment variables us os.environ which is a dictionary of the variables.

Since you are using python, it would be much more sensible to use python program instead of some os.system calls. That is, create python program with the environment variables, add it to your PYTHONPATH and import it in your django code.

Leave a comment