Thank you, Reinout. I don't know which version of python mod_wsgi uses. Here is a list of python versions on my machine.
/Library/Frameworks/Python.framework//Versions/2.7/bin/python /usr/bin/python2.5 /usr/bin/python2.6 /usr/bin/pythonw2.5 /usr/bin/pythonw2.6 /usr/local/bin/python /usr/local/bin/python-32 /usr/local/bin/python2.7 /usr/local/bin/python2.7-32 /usr/local/bin/python3 /usr/local/bin/python3-32 /usr/local/bin/python3.2 /usr/local/bin/python3.2-32 /usr/local/bin/python3.2m /usr/local/bin/pythonw /usr/local/bin/pythonw-32 /usr/local/bin/pythonw2.7 /usr/local/bin/pythonw2.7-32 /usr/local/bin/pythonw3 /usr/local/bin/pythonw3-32 /usr/local/bin/pythonw3.2 /usr/local/bin/pythonw3.2-32 As you can see, there is no /usr/bin/python. And '/usr/local/bin/python --version' gives Python 2.7.2., which is normally what I use. For your second suggestion, I don't know if apache can access mysql libraries. Can you tell me how to find out? On Wed, Aug 24, 2011 at 2:05 AM, Reinout van Rees <rein...@vanrees.org>wrote: > On 23-08-11 00:37, Jim wrote: > >> This probably has been discussed many times, but I still can't find any >> solution yet. Basically, it turns out that python can load MySQLdb just >> fine, but Apache can't load MySQLdb from the wsgi script. >> >> > - Does apache use the virtualenv's environment? And this is what I got from > 'print os.environ' in the .wsgi file. > >$ python django.wsgi {'TEXPATH': '/usr/local/texlive/2010/texmf-dist/tex/latex', 'PROMPT_COMMAND': 'echo -ne "\\033]0;${tabtit}\\007"', 'IDL_DIR': '/Applications/itt/idl/idl81', 'LOGNAME': 'jianbao', 'USER': 'jianbao', 'ITT_DIR': '/Applications/itt', 'HOME': '/Users/jianbao', 'PATH': '/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/opt/local/bin:/opt/local/sbin:/Users/jianbao/shlib:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/usr/X11/bin:/Users/jianbao/pylib:/usr/local/mysql/bin', 'PS1': '\\n\\e[0;34m$PWD\\e[m\\n>$ ', 'DISPLAY': '/tmp/launch-YVSOek/org.x:0', 'TERM_PROGRAM': 'iTerm.app', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'COLORFGBG': '0;15', 'SHLVL': '1', 'ITERM_SESSION_ID': 'w0t0p0', '_': '/Library/Frameworks/Python.framework/Versions/2.7/bin/python', 'MANPATH': '/opt/local/share/man:', 'ARCHFLAGS': '-arch i386 -arch x86_64', 'SSH_AUTH_SOCK': '/tmp/launch-EXjeyZ/Listeners', 'IDL_STARTUP': '$HOME/idllib/idl_startup.pro', 'DYLD_LIBRARY_PATH': '/usr/local/mysql/lib:', 'Apple_PubSub_Socket_Render': '/tmp/launch-67EotD/Render', 'TMPDIR': '/var/folders/Yb/YbFx+MU1HhWVkmSHSxe4fk+++TI/-Tmp-/', 'LSCOLORS': 'ExFxCxDxBxegedabagacad', 'IDL_DLM_PATH': '<IDL_DEFAULT>:+/Users/jianbao/idllib/DLM/idl_geopack_75:+/Users/jianbao/idllib/spice/icy/lib', 'PYTHONSTARTUP': '/Users/jianbao/pylib/startup.py', 'IDL_PATH': '<IDL_DEFAULT>', 'OLDPWD': '/Users/jianbao/projects/tao.com/djangoSite/bin', 'CLICOLOR': '1', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': '/Users/jianbao/projects/tao.com/djangoSite/apache', 'tabtit': 'djangoSite', 'COMMAND_MODE': 'unix2003'} I don't see any clue, though. Thank you very much. > > - Mod_wsgi: does that use the correct python version? mod_wsgi normally > uses /usr/bin/python (python 2.5 or 3.2 whatever) and you might have used > /usr/bin/python2.7. > > - Can the apache process find the mysql libraries? Are the environement > variables different? Try printing "os.environ" from your .wsgi script for > instance. > > Just some brainstorming. > > > Reinout > > -- > Reinout van Rees http://reinout.vanrees.org/ > rein...@vanrees.org > http://www.nelen-schuurmans.**nl/<http://www.nelen-schuurmans.nl/> > "If you're not sure what to do, make something. -- Paul Graham" > > -- > 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+unsubscribe@** > googlegroups.com <django-users%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en> > . > > -- 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.