0
votes

I asked this question before, but had no replies, maybe I wasn't so clear.

I'm trying to debug a django project using MySQL database. If I run the admin or trying to use the shell to communicate to the data base every thing is well and I can do every thing. I installed MySQLdb for Python 2.6.

I installed PyDev on my Apatana studio. Configured the Debugging with runserver 8001 --noreload.

When I start debugging , When I arrive to the following code in C:\Python26\Lib\site-packages\django\db\backends\mysql\base.py

try: import MySQLdb as Database except ImportError, e: from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

I get an import error : django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: DLL load failed: The specified module could not be found.

I trying to ge more deeply with the import MySQLdb as Database line , it goes to the C:\Python26\Lib\site-packages\MySQLdb__init__.py and fail in the line import _mysql.

I can't understand the problem. When running the Django admin every thing is ok, but with debugging it fails to work.

Any help please. Thanks in advance.

1
Which version of django and MySQLdb are you using? - sharjeel
What happens if you just do 'import MySQLdb' in python? is DATABASE_ENGINE set to 'mysql'? - user67627
do you really need to import MySQLdb ? If you need to use the same connection as defined in django database settings, you'd better use : from django.db import connection cursor = connection.cursor() - jujule
is mysqldb in your python path when running through Aptana? - Brandon Henry

1 Answers

0
votes

I had this problem and it turned out to be that I had the python paths in Aptana setup wrong. In Aptana -> Preferences -> PyDev -> Interpreter -> PythonRun

I had /Library/Python/2.5/site-packages/ whereas all my packages were actually in /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

Fixed this and all was well!