Python paths in subprocess.popen with Apache mod_wsgi and virtualenv

If you are using subprocess.Popen to run an external process while running Python/Django with a virtual environment in Apache via mod_wsgi you'll discover the new processes run outside of your virtual environment. In my case, I need to set the PYTHONPATH environment variable to get everything straight. Rather than hardcode it or the sys.path in the external script, I'd like to set it to the same value as the existing environment.

Subscribe to Apache