Django failed to load MySQLdb module

71 views
Skip to first unread message

Zhu Wayne

unread,
Oct 31, 2012, 2:53:48 PM10/31/12
to revie...@googlegroups.com
I am using Python 2.4.3 and can import MySQLdb without any issue in the shell.
$python -V
Python 2.4.3
$python
Python 2.4.3 (#1, Nov  3 2010, 12:52:40)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb;

However, httpd log shows error:
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1] mod_wsgi (pid=550): Exception occurred processing WSGI script '/
var/www/reviews.com/htdocs/reviewboard.wsgi'.
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/core/handlers/wsgi.py", line 250, in __call__
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     self.load_middleware()
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/core/handlers/base.py", line 45, in load_middleware
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     mod = import_module(mw_module)
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/utils/importlib.py", line 35, in import_module
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     __import__(name)
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Djblets-0.6.23-py2.4.eg
g/djblets/siteconfig/middleware.py", line 27, in ?
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     from djblets.siteconfig.models import SiteConfiguration
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Djblets-0.6.23-py2.4.eg
g/djblets/siteconfig/models.py", line 26, in ?
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     from django.contrib.sites.models import Site
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/contrib/sites/models.py", line 1, in ?
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     from django.db import models
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/db/__init__.py", line 78, in ?
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     connection = connections[DEFAULT_DB_ALIAS]
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/db/utils.py", line 93, in __getitem__
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     backend = load_backend(db['ENGINE'])
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/db/utils.py", line 33, in load_backend
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     return import_module('.base', backend_name)
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/utils/importlib.py", line 35, in import_module
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     __import__(name)
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]   File "/usr/lib/python2.4/site-packages/Django-1.3.3-py2.4.egg/
django/db/backends/mysql/base.py", line 14, in ?
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1]     raise ImproperlyConfigured("Error loading MySQLdb module: %s
" % e)
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1] ImproperlyConfigured: Error loading MySQLdb module: No module na
med MySQLdb
[Wed Oct 31 11:36:27 2012] [error] [client 127.0.0.1] mod_wsgi (pid=553): Exception occurred processing WSGI script '/
var/www/reviews.com/htdocs/reviewboard.wsgi'.

Anyone knows how to fix it? I am not an expert on Python.

Christian Hammond

unread,
Oct 31, 2012, 3:38:41 PM10/31/12
to revie...@googlegroups.com
Hi Zhu,

Strange. Looks like it'd be okay, provided that the Python paths are the same.

Which distro is this?

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com



--
Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to reviewboard...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en
 
 

Stephen Gallagher

unread,
Nov 1, 2012, 9:00:11 AM11/1/12
to revie...@googlegroups.com, Zhu Wayne
On 10/31/2012 02:53 PM, Zhu Wayne wrote:
> I am using Python 2.4.3 and can import MySQLdb without any issue in the
> shell.
> $python -V
> Python 2.4.3
> $python
> Python 2.4.3 (#1, Nov 3 2010, 12:52:40)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb;
>


RHEL 5 prior to 5.8 had a version of the MySQL-python package that is
too old for Django: https://bugzilla.redhat.com/show_bug.cgi?id=475854

You need to upgrade to the latest version of the package:
MySQL-python-1.2.3-0.1.c1.el5

Reply all
Reply to author
Forward
0 new messages