I have worked through the Django tutorial parts 1 and 2 with an Oracle back end using the development server. Everything worked fine. I now want to use a real server - Apache + mod_wsgi. I've got to the point where I get an "Improperly Configured at /" page, which shows the following:
Exception Type: ImproperlyConfigured
Exception Value: Error loading cx_Oracle module: libclntsh.so.11.1: cannot open shared object file: No such file or directory
Exception Location: /usr/lib/python2.7/site-packages/django/db/backends/oracle/base.py in <module>, line 46
Line 46 raises exception ImproperlyConfigured on a try block which imports cx_Oracle.
cx_Oracle is properly installed. In my desktop environment:
$ python
>>> import cx_Oracle
works fine. I also export LD_LIBRARY_PATH which points to where libclntsh.so.11.1 resides. If I clear this environment
variable, import cx_Oracle fails with:
ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory
It looks like I have to tell my app what my path to libclntsh.so.11.1 is. I have added:
os.environ['LD_LIBRARY_PATH'] = '/oracle/product/11.1.0/db_1/lib'
to my app's wsgi.py file, but this does resolve my problem.
Can anyone assist with how to progress this?
Environment:
O/S: Fedora14
Apache: 2.2.17
Python: 2.7
mod_wsgi: 3.2
cx_Oracle: 5.1
Django: 1.4.1