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:
On Monday, September 10, 2012 2:41:00 PM UTC+10, Jon Blake wrote:
> 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:
> to my app's wsgi.py file, but this does resolve my problem.
LD_LIBRARY_PATH has to be set before the process starts to be honored. So it's not sufficient to set it in the wsgi file with os.environ; you need to use an Apache SetEnv directive, or use a script to export it in the Apache process's environment variables when Apache is started. Or as a third option, use ldconfig to make the Oracle library path globally visible.
I've been using ldconfig to handle libs. It's easy as runnig following few
commands as a root. (Though I always use oracle instantclient, it's just
simpler in many cases):
>> to my app's wsgi.py file, but this does resolve my problem.
> LD_LIBRARY_PATH has to be set before the process starts to be honored. So
> it's not sufficient to set it in the wsgi file with os.environ; you need to
> use an Apache SetEnv directive, or use a script to export it in the Apache
> process's environment variables when Apache is started. Or as a third
> option, use ldconfig to make the Oracle library path globally visible.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
-- Jani Tiainen
- Well planned is half done, and a half done has been sufficient before...
Thanks, Jani and Ian. I've used the ldconfig approach to fix this problem. Now getting a "ImportError at /" page, for which I'll post another question.
On Tuesday, September 11, 2012 6:15:57 AM UTC+10, Jani Tiainen wrote:
> I've been using ldconfig to handle libs. It's easy as runnig following few > commands as a root. (Though I always use oracle instantclient, it's just > simpler in many cases):
>>> to my app's wsgi.py file, but this does resolve my problem.
>> LD_LIBRARY_PATH has to be set before the process starts to be honored. >> So it's not sufficient to set it in the wsgi file with os.environ; you need >> to use an Apache SetEnv directive, or use a script to export it in the >> Apache process's environment variables when Apache is started. Or as a >> third option, use ldconfig to make the Oracle library path globally visible.
>> To post to this group, send email to django...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> django-users...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en.
> -- > Jani Tiainen
> - Well planned is half done, and a half done has been sufficient before...
set the ORACLE_HOME variable of the user who run site
SuexecUserGroup inof inof
env |grep ORA
ORACLE_BASE=/usr/lib/oracle
ORACLE_HOME=/usr/lib/oracle/11.2/client64/
On 11 September 2012 03:05, Jon Blake <jc.bla...@gmail.com> wrote:
> Thanks, Jani and Ian. I've used the ldconfig approach to fix this problem.
> Now getting a "ImportError at /" page, for which I'll post another question.
> On Tuesday, September 11, 2012 6:15:57 AM UTC+10, Jani Tiainen wrote:
>> I've been using ldconfig to handle libs. It's easy as runnig following
>> few commands as a root. (Though I always use oracle instantclient, it's
>> just simpler in many cases):
>>>> to my app's wsgi.py file, but this does resolve my problem.
>>> LD_LIBRARY_PATH has to be set before the process starts to be honored.
>>> So it's not sufficient to set it in the wsgi file with os.environ; you need
>>> to use an Apache SetEnv directive, or use a script to export it in the
>>> Apache process's environment variables when Apache is started. Or as a
>>> third option, use ldconfig to make the Oracle library path globally visible.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users...@**
>>> googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.