This really is my application atmosphere:
Redhat 6.0 Apache 2.2 Django 1.3.0 Python 2.6.6 cx_Oracle 5.1 mod_wsgi 3.2 Oracle DBMS 11.2 (on a different machine)
Problem: being able to access my django website from the internet browser fails because cx_Oracle can't acquire Oracle handle.
- running django-admin.py spend to question the db Works (running from the party session with ORACLE_HOME and LD_LIBRARY_PATH vars set)
- managing a custom script that contributes ORACLE_HOME and LD_LIBRARY_Road to os.environ and uses cx_Oracle for connecting to DB, without needing django Works (running from the party session with ORACLE_HOME and LD_LIBRARY_PATH vars set)
- running exactly the same custom script with "sudo -u apache" doesn't work
- running exactly the same custom script with "sudo -u env ORACLE_HOME=foo LD_LIBRARY_PATH=foo myscript.py" Works
- modifying django.db.backends.oracle.base.py to ensure that, prior to the Database.connect statement, I've os.environ printed to some file, SHOWS I've ORACLE_HOME AND LD_LIBRARY_PATH Properly SET
- clearly setting ORACLE_HOME and LD_LIBRARY_PATH in os.atmosphere inside adhoc django wsgi.py script Doesn't Work
- restarting httpd with "sudo env ORACLE_HOME=foo LD_LIBRARY_PATH=foo /etc/init.d/httpd restart" Works
My real question is: exactly why is test 7 not the same as tests 2, 5, 6? To place it one other way, why must i pass env vars to parent httpd process rather than just setting them in python/django scripts?
The LD_LIBRARY_PATH should be within the atmosphere just before a procedure being performed. The procedure runtime loader is only going to see clearly once at startup, altering the need for the atmosphere following the process continues to be began does not matter. Case how things work.