I deploy my Django web sites on Apache2 with mod_wsgi on ubuntu.
In my Django views, I import a module that requires a specific path set in LD_LIBRARY_PATH.
When I set LD_LIBRARY_PATH in /etc/apache2/envvars as:
export LD_LIBRARY_PATH=/home/user/target_libdir:$LD_LIBRARY_PATH
it works.
However, on my server I run multiple django web sites, each in independent VirtualHost entry, with independent wsgi scripts.
The problem is that the web sites need to use different LD_LIBRARY_PATH versions.
So, how can I set LD_LIBRARY_PATH individually for every django web site?
You can’t do it. The LD_LIBRARY_PATH is only read once on initial process start. It cannot be set once process is running nor can you set it again prior to a fork. You can set it prior to an exec, but mod_wsgi daemon processes are fork only and not an exec.