LD_LIBRARY_PATH variable is the correct one to use when running from
your account (not to go into the discussion as to why some people think
LD_LIBRARY_PATH is evil), as evidenced when you run python on the
command line.

In the case of Django running through a web server, the web server is
not picking up the LD_LIBRARY_PATH setting you are using in your own
personal account.

The reason editing ld.so.conf works, is because you are globally setting
the library path to search.  Since ld.so.conf is a 'global' setting,
your Django application (python) picks it up from the system and finds
the library.

Another way (what I do) is to compile Python with the MySQL lib
directory (--with-libs configuration argument) so that Python can find
the library whenever it runs (no matter who's running it, me -- or the
web server).

On Sat, 2009-06-13 at 10:18 -0700, NoCleverName wrote:
> 
> This is the author again.  Of course, 10 minutes after I post a question, I
> find the solution.  (After hours of searching beforehand)
> 
> If anyone else has this problem, the solution for me was:
> 
> edit /etc/ld.so.conf
> add the line: /usr/local/mysql/lib
> 
> then run /etc/ldconfig
> 
> Fixed the problem right up.  No idea why or how this worked, but everything
> is working now.
> 
> 
> 
> NoCleverName wrote:
> > 
> > So I'm having an issue getting Django to work with MySQL.  After I log
> > into my Django site, I get the following error:
> > 
> > ImproperlyConfigured: Error loading MySQLdb module:
> > libmysqlclient_r.so.16: cannot open shared object file: No such file or
> > directory
> > 
> > The error is being thrown from
> > site-packages/django/db/backends/mysql/base.py line 13.
> > 
> > Unlike a lot of similar posts on the message board (I have searched), I
> > have MySQLdb installed.  The lines in question are just 'import MySQLdb as
> > Database' and the associated try/catch throwing the error.  When I run
> > python from a command line and type 'import MySQLdb' it imports just fine. 
> > I added to to the root's .bash_profile and the .bashrc of the 'mysql'
> > user.  The file definitely exists (in /usr/local/mysql/lib)
> > 
> > I used the variable LD_LIBRARY_PATH in the two profiles to make the
> > 'import MySQLdb' statement work, is that the correct environment variable?
> > 
> > As a note, I installed mysql from the .tar.gz files and MySQLpython from
> > the .tar.gz files as well.  I can't use any sort of package manager to
> > install this stuff.
> > 
> 
-- 
Adam Stein @ Xerox Corporation       Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to